Skip to content
A pytest plugin to add markers based on fixtures used.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.flake8
.gitignore
.travis.yml
LICENSE
MANIFEST.in
README.rst
appveyor.yml
pytest_fixture_marker.py
setup.py
tox.ini

README.rst

pytest-fixture-marker

PyPI version Python versions See Build Status on Travis CI See Build Status on AppVeyor

A pytest plugin to add markers based on fixtures used.


Why

This plugin allows you to selectively run tests that require a certain fixture. This comes in handy if you're refactoring fixtures.

Installation

You can install "pytest-fixture-marker" via pip from PyPI:

$ pip install pytest-fixture-marker

Usage

Once installed, the plugin will automatically mark each test. Marker names are generated from the fixture names.

$ # run all tests that use the tempdir fixture
$ pytest -m tempdir_fixture

If you're not happy with the marker name convention of adding a _fixture suffix, you can configure it by setting fixture_marker_expression in pytest.ini (or tox.ini or setup.cfg), or by passing the --fixture-marker-expression argument. If both are specified the argument takes priority.

The fixture marker expression must be a format string that will be filled with one positional argument: the fixture name.

$ # use custom marker naming expression
$ pytest -m foobar_tempdir --fixture-marker-expression=foobar_{}

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, "pytest-fixture-marker" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

You can’t perform that action at this time.