Skip to main content

A pytest plugin to add markers based on fixtures used.

Project description

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 fixture_tempdir

If you’re not happy with the marker name convention of adding a fixture_ prefix, 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.

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-marker-1.0.0.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file pytest-fixture-marker-1.0.0.tar.gz.

File metadata

  • Download URL: pytest-fixture-marker-1.0.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.12

File hashes

Hashes for pytest-fixture-marker-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1d6e68bc8655f2bac05ff656ff467f7e07f23f8b0c10161be11f5a4bff3fe2ac
MD5 37b481149551dd5979e229a99af1659a
BLAKE2b-256 e13d5cacc0d1ff0b36b3c094659ee9083723ed874fb88303f887a80473e14011

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page