pytest-regex-dependency
Management of Pytest dependencies via regex patterns
Installation
pip install pytest-regex-dependency
Use
The following examples are possible use cases for this plugin
-
Test depends on tests with node Ids matching a specified pattern:
test_foo.pyimport pytest def test_a(): pass @pytest.mark.regex_dependency('test_foo\.py::test_a') def test_b(): pass -
Test depends on all tests within module:
test_dependency.pydef test_a(): pass def test_b(): passtest_bar.pyimport pytest @pytest.mark.regex_dependency('test_dependency\.py', target='module') def test_a(): pass -
Test depends on all tests within class:
import pytest class TestClass: def test_a(self): pass @pytest.mark.regex_dependency('TestClass', target="class") def test_b(): pass -
Test depends on all tests functions matching a specified pattern:
import pytest def test_1(): pass def test_2(): pass def test_3(): pass @pytest.mark.regex_dependency('test_[0-9]+$', target='function') def test_a(): pass
Considerations
-
If a test's pattern is not met, the test function will run
In the following example
test_bwill run:import pytest def test_a(): pass @pytest.mark.regex_dependency('test_1') def test_b(): pass -
The outcome of all phases of a dependency test is consider when determining if the calling test should be skipped. This includes the dependency test's setup, call, and teardown phases. If any of the phases do not match the calling test's
allowed_outcomesrequirement, the test will be skipped. This comes into light when a dependency test's fixture teardown logic fails but the dependency test succeeds.The following is an example of this scenario:
import pytest @pytest.fixture def foo(): yield None pytest.fail() def test_a(foo): pass @pytest.mark.regex_dependency('test_a', target="function", allowed_outcomes=["passed"]) def test_b(): pass
Metadata
Release files for pytest-regex-dependency 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest-regex-dependency-0.1.1.tar.gz | 7.0 kB | Without provenance | Details for pytest-regex-dependency-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_regex_dependency-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pytest_regex_dependency-0.1.1-py3-none-any.whl |
Total release size: 14.7 kB
Release files / pytest-regex-dependency-0.1.1.tar.gz
| Download URL | pytest-regex-dependency-0.1.1.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6372f4a629f84b5acd71f26a36fd3ca5d041debd4b4feb4ed0775abaeeb1756
|
|
BLAKE2b-256 checksum How to use checksums |
316f9e55ea24042134850df7834ccf0a401440a503ea6ac701c1f2ce10814986
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / pytest_regex_dependency-0.1.1-py3-none-any.whl
| Download URL | pytest_regex_dependency-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
abb43928df9180f892120bdc0b82752c1b1bc8ef7d48b9846597e0bb79c42d31
|
|
BLAKE2b-256 checksum How to use checksums |
de8caf5d94cbe2db43207fc05fa156bac0c23ad1e33942b5a3b774abf0294f1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for pytest-regex-dependency 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.