Skip to main content

pytest-filterfixtures

pytest-filterfixtures is a pytest plugin to filter tests based on their fixtures.

This is particularly useful in large test codebases when fixtures require changes/refactoring, or a specific fixture stops wokring due to external reasons. You can work on modifying the fixture(s) and have better control over which tests should run.

Installation

Install with pip

pip install pytest-filterfixtures

Usage

pytest-filterfixtures adds the following command line options:

  • --include-fixtures to execute all tests that use at least one of the specified fixtures as part of their setup/teardown
  • --exclude-fixtures to deselect all tests that use at least one of the specified fixtures as part of their setup/teardown

Example

Given the following test file

@pytest.fixture()
def fixt1():
    return 1

@pytest.fixture()
def fixt2():
    return 2

@pytest.fixture()
def fixt3(fixt1):
    return fixt1 + 1

def test1(fixt1):
    ...

def test2(fixt2):
    ...

def test3(fixt3):
    ...
  • pytest --include-fixtures fixt1 fixt2 executes test1, test2, test3
  • pytest --include-fixtures fixt3 executes test3
  • pytest --exclude-fixtures fixt1 executes test2
  • pytest --exclude-fixtures fixt3 --include-fixtures fixt1 executes test1

Metadata

Release files for pytest-filterfixtures 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-filterfixtures 0.1.0
File Size Uploaded
pytest_filterfixtures-0.1.0.tar.gz 1.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-filterfixtures 0.1.0
File Interpreter ABI Platform
pytest_filterfixtures-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.9 kB

Release files / pytest_filterfixtures-0.1.0.tar.gz

Download URL pytest_filterfixtures-0.1.0.tar.gz
Size 1.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3530402c2ea3b9688d61815343777b41f7e4756a87b1387aa211df33871cd1af
BLAKE2b-256 checksum
How to use checksums
bda45e6a924b4582634bbfbe3daa4a9b0bab8294393a4d7b86ac17f59cb2559f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pytest_filterfixtures-0.1.0-py3-none-any.whl

Download URL pytest_filterfixtures-0.1.0-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0365adebb1875a3ba9df9f2a3de36e06ce340f8531f4575405ea1703c2e63364
BLAKE2b-256 checksum
How to use checksums
927818a57158b310c2a051ff59b622d03ab6e9d70f8b7d004b63e0dce928bfd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page