Skip to main content

Plugin for pytest which provides tools for fixtures

Project description

pytest-fixture-tools: Pytest fixture tools plugin

The pytest-fixture-tools package is a pytest plugin which provides various tools for fixture.

https://api.travis-ci.org/paylogic/pytest-fixture-tools.png https://pypip.in/v/pytest-fixture-tools/badge.png https://coveralls.io/repos/paylogic/pytest-fixture-tools/badge.png?branch=master

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-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:

alternate text

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.0.0

  • Initial public release

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-fixture-tools-1.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

pytest_fixture_tools-1.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest-fixture-tools-1.1.0.tar.gz.

File metadata

  • Download URL: pytest-fixture-tools-1.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pytest-fixture-tools-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c3713ac6ce94869a687b240dc1cb25122c6cfa38e8e0639fc8366a32a2514524
MD5 e22adf3f1448b9b36417a10e83824286
BLAKE2b-256 2c0aef0a3eedd72f9c625e3d7a69fd58dc69c8c61cd1661732f40a3ff1d587fd

See more details on using hashes here.

File details

Details for the file pytest_fixture_tools-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_fixture_tools-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pytest_fixture_tools-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b650d0cacbdd903ece282398d842bc9f10f0bcd024a7a090aa60b8c9fbc6dae0
MD5 e028e09092620d97db14736d36d39f55
BLAKE2b-256 730f50d44b66b10132d48907fd926b7653c3eda09b485d603e13d9392d66e71a

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