pytest plugin to execute or ignore tests based on fixtures
Project description
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-fixturesto execute all tests that use at least one of the specified fixtures as part of their setup/teardown--exclude-fixturesto 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 fixt2executestest1, test2, test3pytest --include-fixtures fixt3executestest3pytest --exclude-fixtures fixt1executestest2pytest --exclude-fixtures fixt3 --include-fixtures fixt1executestest1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_filterfixtures-0.1.0.tar.gz.
File metadata
- Download URL: pytest_filterfixtures-0.1.0.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3530402c2ea3b9688d61815343777b41f7e4756a87b1387aa211df33871cd1af
|
|
| MD5 |
97cb9f3ac478cc7c8f3de48ad643365f
|
|
| BLAKE2b-256 |
bda45e6a924b4582634bbfbe3daa4a9b0bab8294393a4d7b86ac17f59cb2559f
|
File details
Details for the file pytest_filterfixtures-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytest_filterfixtures-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0365adebb1875a3ba9df9f2a3de36e06ce340f8531f4575405ea1703c2e63364
|
|
| MD5 |
e27575966d2cf0eacbdb8e47a7d9c37d
|
|
| BLAKE2b-256 |
927818a57158b310c2a051ff59b622d03ab6e9d70f8b7d004b63e0dce928bfd0
|