pytest-only
Use @pytest.mark.only to run a single test
What it is and what it does
pytest-only is a pytest plugin that selectively runs only the tests you mark with @pytest.mark.only, skipping all unmarked tests in the same run. If no tests are marked, all tests run normally. You can apply the marker to individual test functions, entire test classes, or at the module level via pytestmark. The plugin also includes a pylint checker to warn against accidentally committing focused tests.
The package is a thin wrapper around pytest's marker system, designed for development workflows where you want to isolate a single test or a small subset without modifying your test suite structure. It borrows the concept from mocha's .only pattern and provides a --no-only flag to temporarily disable the filtering behavior.
Use it for:
- Isolate a failing test during debugging without commenting out or deleting other tests
- Focus on a specific test class or module during active development
- Temporarily run only new tests while implementing a feature, then remove the marker before commit
- Use the bundled pylint plugin to catch stray @pytest.mark.only markers before they reach version control
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that runs only tests marked with @pytest.mark.only, skipping all others unless the marker is disabled with --no-only.
Yes, if you use pytest and want a lightweight way to focus on individual tests during development. The plugin is stable, has no security vulnerabilities, and adds minimal friction (only pytest as a dependency). Dormant maintenance is not a concern for a narrow, stable tool, but verify compatibility with your pytest version if you run a very recent release.
Install
pytest-only on PyPI
pip
pip install pytest-onlyuv
uv add pytest-onlypoetry
poetry add pytest-onlyInstalling pytest-only
Before you install
Low friction install with only pytest as a runtime dependency. Maintenance is dormant (last release 2024-05-27, 809 days ago), but the package is marked Production/Stable and the repository is not archived, suggesting it remains functional for its narrow scope.
License in practice
MIT license is permissive, allowing unrestricted use, modification, and distribution in both open-source and commercial projects.
Quickstart
pip install pytest-only
import pytest
@pytest.mark.only
def test_focused():
assert True
# Run with: pytest
Verify before relying
- Whether the plugin remains compatible with pytest versions released after 2024-05-27
- Whether the bundled pylint checker (pytest_only.ext.pylint) is actively maintained
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | dormant — 809 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 76,871/month — #14,585 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_only-2.1.2-py3-none-any.whl
Keywords: pytest
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-skip-slowA pytest plugin that skips tests marked with…
permissive · top 15,000 on PyPI
pytest-timestamperA pytest plugin that prefixes each test output…
unclear · top 15,000 on PyPI
pytest-skip-markersA pytest plugin that provides skip markers to…
permissive · top 15,000 on PyPI
pytest-pickedA pytest plugin that automatically runs only…
permissive · top 5,000 on PyPI
tavernTavern is a pytest plugin and command-line tool…
permissive · top 15,000 on PyPI
pytest-dependencyA pytest plugin that marks tests as dependent…
permissive · top 5,000 on PyPI
pytest-mpiA pytest plugin that marks and runs tests under…
permissive · top 15,000 on PyPI
pytest-enablerA pytest plugin that conditionally enables…
permissive · top 15,000 on PyPI
pytest-filter-subpackageA pytest plugin that adds a `-P` option to run…
permissive · top 15,000 on PyPI
pytest-cacheA pytest plugin that persists test state across…
permissive · top 15,000 on PyPI