Nifty pytest
A pytest test explorer with saved run configurations, marker filters, real assertion diffs, rerun-failed and slowest-test reports.
Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.
Features


- Your pytest suite in the Test Explorer. Files, classes, tests and every parametrized case, with run buttons in the gutter and each test's markers (
@slow, @db) shown next to it. Discovery uses pytest itself, so conftest.py, plugins and pytest.ini / pyproject.toml settings all apply.
- Assertion diffs that are actually readable. When
assert result == expected fails, the failure opens VS Code's side-by-side diff of the two values, pretty-printed, not a wall of E lines.
- Saved run configurations. Define "Fast", "Integration only" or "With coverage" once in settings and pick them from the Run and Debug dropdowns. Each has its own arguments and environment variables.
- Marker and keyword runs. Run Tests with Marker… lists the markers used in your suite (and their
not versions). Run Tests Matching… runs a -k expression.
- Rerun Failed Tests in one click from the Test Explorer toolbar.
- Show Slowest Tests from the last run, and jump straight to them.
- Debug any test with the Python Debugger, including through a saved configuration.
- Setup and teardown errors are shown as errors, skips and xfails as skipped, and each test's captured output is attached to it.
- Uses your interpreter: the one selected in the Python extension (venv, conda, uv, Poetry), or
nifty.pytest.pythonPath.
Example configuration
// .vscode/settings.json
"nifty.pytest.configurations": [
{ "name": "Fast", "args": ["-m", "not slow", "-x"] },
{ "name": "Integration", "args": ["-m", "integration"], "env": { "DATABASE_URL": "postgres://localhost/test" } }
]
Commands
| Command |
What it does |
Nifty pytest: Refresh Tests |
Rediscover tests |
Nifty pytest: Run All Tests |
Run the whole suite |
Nifty pytest: Run Tests with Marker… |
Run tests selected by a marker expression (-m) |
Nifty pytest: Run Tests Matching (-k)… |
Run tests whose names match a keyword expression |
Nifty pytest: Rerun Failed Tests |
Run only the tests that failed last time |
Nifty pytest: Show Slowest Tests |
The slowest tests of the last run |
Nifty pytest: Add Run Configuration… |
Save a named set of pytest arguments |
Settings
| Setting |
Default |
What it does |
nifty.pytest.pythonPath |
"" |
Interpreter with pytest installed. Empty uses the Python extension's selection |
nifty.pytest.args |
[] |
Arguments added to every run and discovery |
nifty.pytest.env |
{} |
Environment variables for every run |
nifty.pytest.configurations |
[] |
Saved run configurations (see above) |
nifty.pytest.autoDiscover |
true |
Discover tests on startup and when test files change |
Using it alongside the Python extension
Microsoft's Python extension also lists pytest tests. To avoid seeing each test twice, turn its runner off with "python.testing.pytestEnabled": false in the workspace, or hide one of the two in the Test Explorer's filter.
Install
- VS Code: search for "Nifty pytest" in the Extensions view, or install from the Visual Studio Marketplace.
- Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.
Privacy
This extension collects no telemetry and needs no account.
- Nifty JS Tests: Mocha, node:test & Bun in Test Explorer: Run and debug Mocha, node:test and Bun tests from the Test Explorer: real diffs, stack locations, watch mode, TypeScript loaders and monorepos. No Jest or Vitest. (Open VSX)
- Nifty Python Profiler: cProfile Hotspots Inline: Profile Python scripts and pytest runs with cProfile: hotspot table, call counts and timings inline next to each function. (Open VSX)
- Nifty .NET Explorer: Solution & Test Explorer: A solution explorer and test explorer for .NET in VS Code, Cursor, Windsurf and VSCodium: projects, references and files from .sln/.slnx, and xUnit, NUnit and MSTest tests in the Testing view. (Open VSX)
- Nifty Python Pack: 7 Nifty extensions for Python development: Python Envs, pytest, Python Profiler, Python REPL, Docstrings, Paired Notebooks, Notebook Servers. (Open VSX)
- Nifty Bash Debugger: Breakpoints & Step Through Scripts: Debug Bash scripts without bashdb: breakpoints, conditions, logpoints, stepping, call stack, variables and arrays. Works with bash 4.2 to 5.2+ and Git Bash on Windows. (Open VSX)
- Nifty Code Runner: Run Code in 25+ Languages: Run the current file or selection in 25+ languages in the terminal, with input support, your own commands and no telemetry. (Open VSX)
See all 100+ Nifty extensions and web tools at https://getnifty.dev
| |