Skip to main content

A pytest plugin to collect tests based on fixtures being used by tests

Project description

PyPI version Python versions See Build Status on AppVeyor

A pytest plugin to collect tests based on fixtures being used in tests


This pytest plugin was generated with Cookiecutter along with @hackebrot’s cookiecutter-pytest-plugin template.

Features

  • Filter tests collection/execution based on fixtures being used by tests

  • One or more number(comma separated) of fixtures are supported with option –uses-fixtures

One can combine fixture based collection with pytests default options/plugins for further smart collection.

Requirements

  • Python >= 3.9

  • Pytest >= 3.5

Installation

You can install “pytest-fixturecollection” via pip from PyPI:

$ pip install pytest-fixturecollection

Usage

Once plugin is installed, run pytest command with “–uses-fixtures” option as shown below:

# pytest --uses-fixtures fixture1,fixture2 tests/

Explanation: All the tests using fixture1 or fixture2 inside tests directory would be collected and executed and rest tests would be uncollected (not executed). You can also choose to just –collect-only to view what tests are collected.

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 BSD-3 license, “pytest-fixturecollection” 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-fixturecollection-0.1.2.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

pytest_fixturecollection-0.1.2-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

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