Coder Social home page Coder Social logo

pytest-fixture-tools's Introduction

pytest-fixture-tools: Pytest fixture tools plugin

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

image

image

image

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:

bash

# on windows gitbash as example export PATH=$PATH:/c/ProgramFiles(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:UsersifruchteProjectspytest-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_toolsplugin.py . [ 28%] tests__init__.py . [ 42%] testsconftest.py . [ 57%] teststest_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:usersifruchteappdatalocaltemppytest-of-ifruchtepytest-445test_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.

pytest-fixture-tools's People

Contributors

amakhnach avatar bubenkoff avatar fruch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.