Skip to main content

Auto-focus plugin: run only @pytest.mark.focus tests when --auto-focus is set

Project description

pytest-autofocus

Auto-focus plugin for pytest: run only @pytest.mark.focus tests when --auto-focus is set, otherwise run all tests.

Installation

pip install pytest-autofocus

Usage

Mark tests with @pytest.mark.focus:

import pytest

def test_normal():
    pass

@pytest.mark.focus
def test_focused():
    pass

Run with --auto-focus to run only focused tests (if any exist), otherwise run all tests:

pytest --auto-focus

If no tests are marked with @pytest.mark.focus, all tests run normally.

Run without --auto-focus to run all tests:

pytest

pytest-watcher Integration

Use with pytest-watcher for automatic test filtering:

ptw . -- --auto-focus

Requirements

  • Python 3.10+
  • pytest 7.0+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_autofocus-0.1.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_autofocus-0.1.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file pytest_autofocus-0.1.2.tar.gz.

File metadata

  • Download URL: pytest_autofocus-0.1.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for pytest_autofocus-0.1.2.tar.gz
Algorithm Hash digest
SHA256 86ce65a1cd253c6d69bfc125ee145e1e0fb0662bf8972928530c837bb4c49bb2
MD5 81259576d2b958cff170a407a568921b
BLAKE2b-256 405e35e28a1b13b0a18da585482f72797ff023eecbdeba5159a8c6dcbe23a331

See more details on using hashes here.

File details

Details for the file pytest_autofocus-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_autofocus-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c2c19b7514dc009f9eef8f9675d8e3cd5d22b4e4f744956ad84d977b222723e5
MD5 dd0fa147435bc927d2391dadf88ebdaf
BLAKE2b-256 63bb37231ea55481324e9b343a8dc3c476e6d7d3d2fa2b0c0f8eabef25b4a6a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page