skillfed

pytest-only

Use @pytest.mark.only to run a single test

pytest-only v2.1.2 76.9K downloads/30d#14,585 on PyPI19
Permissive license MIT DORMANT released

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-only

uv

uv add pytest-only

poetry

poetry add pytest-only

Installing 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

Development Status :: 5 - Production/StableFramework :: PytestLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Testing

Tags

pytest selective test executionrun only marked tests pytestpytest focus single testskip tests except markedpytest.mark.only pluginconditional test filtering pytest
test-filteringdevelopment-workflow

More Testing packages

pluggy

Pluggy provides a plugin system that lets you…

permissive · top 100 on PyPI

pytest

pytest is a testing framework that lets you…

permissive · top 100 on PyPI

virtualenv

virtualenv creates isolated Python environments…

permissive · top 100 on PyPI

coverage

Coverage.py measures which lines of Python code…

permissive · top 1,000 on PyPI

pytest-asyncio

pytest-asyncio is a pytest plugin that enables…

permissive · top 1,000 on PyPI

pytest-json-ctrf

A pytest plugin that generates test reports in…

permissive · top 1,000 on PyPI

pytest-skip-slow

A pytest plugin that skips tests marked with…

permissive · top 15,000 on PyPI

pytest-timestamper

A pytest plugin that prefixes each test output…

unclear · top 15,000 on PyPI

pytest-skip-markers

A pytest plugin that provides skip markers to…

permissive · top 15,000 on PyPI

pytest-picked

A pytest plugin that automatically runs only…

permissive · top 5,000 on PyPI

tavern

Tavern is a pytest plugin and command-line tool…

permissive · top 15,000 on PyPI

pytest-dependency

A pytest plugin that marks tests as dependent…

permissive · top 5,000 on PyPI

pytest-mpi

A pytest plugin that marks and runs tests under…

permissive · top 15,000 on PyPI

pytest-enabler

A pytest plugin that conditionally enables…

permissive · top 15,000 on PyPI

pytest-filter-subpackage

A pytest plugin that adds a `-P` option to run…

permissive · top 15,000 on PyPI

pytest-cache

A pytest plugin that persists test state across…

permissive · top 15,000 on PyPI