pytest-fixture-tools: Pytest fixture tools plugin
The pytest-fixture-tools package is a pytest plugin which provides various tools for fixture.
Installation
pip install pytest-fixture-tools
Usage
show-fixture-duplicates
If you have already installed pytest-fixture-tools plugin then you can use one of its commands.
--show-fixture-duplicates - will collect all fixtures and print you a list of duplicates for each fixture.
With --show-fixture-duplicates you can use --fixture name_of_fixture option to get list of duplicates only for specific fixture
py.test tests/ --show-fixture-duplicates --fixture order
Output can look like this:
========================================== test session starts ==========================================
platform linux2 -- Python 2.7.3 -- pytest-2.5.1 -- /home/batman/.virtualenvs/arkham-city/bin/python
Tests are shuffled using seed number 355495648184.
cachedir: /home/batman/.virtualenvs/arkham-city/.cache
plugins: fixture-tools, random, bdd-splinter, pep8, cov, contextfixture, bdd, xdist, instafail, cache
collected 2347 items / 1 skipped
------------------------------------------------- order -------------------------------------------------
tests/fixtures/order.py:30
tests/unit/api/conftest.py:261
fixture-graph
You can generate the usage fixture graph like that:
# on windows gitbash as example
export PATH=$PATH:/c/Program\ Files\ \(x86\)/Graphviz2.38/bin/
pytest --fixture-graph -s
# or you can select the output direcotry like that:
pytest --fixture-graph --fixture-graph-output-dir=./test_output
# you can also change the output type of the graphs (any of graphvis supported outputs types):
pytest --fixture-graph --fixture-graph-output-type=jpg
The output would be like that:
============================= test session starts =============================
platform win32 -- Python 2.7.10, pytest-3.3.1, py-1.5.2, pluggy-0.6.0
rootdir: C:\Users\ifruchte\Projects\pytest-fixture-tools, inifile: tox.ini
plugins: pep8-1.0.6, cov-2.5.1, fixture-tools-1.0.0
collected 7 items
pytest_fixture_tools\__init__.py . [ 14%]
pytest_fixture_tools\plugin.py . [ 28%]
tests\__init__.py . [ 42%]
tests\conftest.py . [ 57%]
tests\test_fixture_duplicates.py .
-------------------------------- fixture-graph --------------------------------
created artifacts/fixture-graph-tests-test_fixture_duplicates.py__test_there_are_fixture_duplicates.png.
============================= test session starts =============================
platform win32 -- Python 2.7.10, pytest-3.3.1, py-1.5.2, pluggy-0.6.0
rootdir: c:\users\ifruchte\appdata\local\temp\pytest-of-ifruchte\pytest-445\test_there_are_not_fixture_duplicates0, inifile:
plugins: pep8-1.0.6, cov-2.5.1, fixture-tools-1.0.0
collected 2 items
======================== no tests ran in 0.06 seconds =========================
.s [100%]
===================== 6 passed, 1 skipped in 0.29 seconds =====================
Final output, that can help with tests that depend on large amount of fixtures:
Contact
If you have questions, bug reports, suggestions, etc. please create an issue on the GitHub project page.
License
This software is licensed under the MIT license
See License
© 2013 Paylogic International.
Changelog
1.2.1
Fix typo in README.rst by @lebrice in https://github.com/pytest-dev/pytest-fixture-tools/pull/10
Fix #8 - Remove migrate setup.py to pyproject.toml by @ogajduse in https://github.com/pytest-dev/pytest-fixture-tools/pull/9
Fix getfixturedefs call by @MaksimKravchuk in https://github.com/pytest-dev/pytest-fixture-tools/pull/12
1.2.0
Fix –fixture-graph-output-dir and –fixture-graph-output-type by @youtux in https://github.com/pytest-dev/pytest-fixture-tools/pull/5
Python and pytest compatibility fixes by @ogajduse in https://github.com/pytest-dev/pytest-fixture-tools/pull/7
Drop support for EOL Python versions
1.1.0
Added fixture-graph option.
1.0.0
Initial public release
Metadata
Release files for pytest-fixture-tools 1.2.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_fixture_tools-1.2.1.tar.gz | 6.6 kB | Without provenance | Details for pytest_fixture_tools-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_fixture_tools-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for pytest_fixture_tools-1.2.1-py3-none-any.whl |
Total release size: 12.9 kB
Release files / pytest_fixture_tools-1.2.1.tar.gz
| Download URL | pytest_fixture_tools-1.2.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51bdf6fbb7737c8e92c29f4ff0fb2e4ab349057fa7439f48164b4ea6567a74ed
|
|
BLAKE2b-256 checksum How to use checksums |
ccfe8dcd58527f75701480762054d5314a31d96e75ec3353bf89a2e51d546ac4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.2
|
Release files / pytest_fixture_tools-1.2.1-py3-none-any.whl
| Download URL | pytest_fixture_tools-1.2.1-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2209b91ee3694cf857b2fc768547c92b3fd168a39a58b1df793c49f8a319eb11
|
|
BLAKE2b-256 checksum How to use checksums |
6ba5ee5916704535bb604486b69bf60afc5ba19707b9a9968ebf1a040afb1c6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.2
|
Security for pytest-fixture-tools 1.2.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.