pytest vs nose: Python Test Runner Compared
pytest is the modern, actively maintained Python test runner; nose (and nose2) is older, with the original nose unmaintained.
pytest is the de facto Python testing framework, with concise assert-based tests, powerful fixtures, parametrization, and a vast plugin ecosystem. nose extended unittest with test discovery and was widely used, but the original nose is unmaintained and nose2 sees limited activity. New projects use pytest; older nose suites are usually migrated.
| pytest | nose | |
|---|---|---|
| Maintenance | Active | nose unmaintained; nose2 limited |
| Fixtures | Powerful, composable | Basic |
| Plugins | Large ecosystem | Few |
| Assertions | Plain assert (rewritten) | unittest-style |
| Best for | All new Python projects | Legacy suites only |
In CI
pytest integrates cleanly in CI with rich reporting, xdist parallelism, and coverage plugins. nose works but lacks maintenance and modern plugins. For any new project, pytest is the clear choice; migrating nose suites to pytest is generally recommended. Cache the Python environment for fast installs either way.
Speed it up
Cache the pip/poetry environment and parallelize with pytest-xdist. Both run on CI runners; faster managed runners shorten install and test steps.
The verdict
Use pytest for any new Python project - it is modern, maintained, and far richer. nose only matters for legacy suites you have not migrated yet; plan that migration to pytest.