Skip to main content

Additional pytest markers to dynamically enable/disable tests viia CLI flags

Project description



A pytest plugin to dynamically skip tests based on marks


pip install git+


Consider the following test scenario:

import pytest

# A
def test_speedy_unit_test():

# B
def test_integration_test():

# C
def test_super_slow_integration_test():

You want to quickly run all your quick unit tests before committing. Then, after you are happy that the changes haven't messed up any unit tests you want to run the integration tests, and then after that your super slow integration tests. This would look like:

pytest --only-integration
pytest --only-slow-integration

In theory, your quick unit tests give you feedback instantly about anything that's been broken by your changes. After that, the slower integration tests can be run to have a more broad check.

Author's note My use cases is mainly for simulations, so the --only-slow-integration flag can sometimes take tens of minutes to run whereas an integration test might take milliseconds. Therefore, I made the distinction between the two.

CLI Flags

Flag Description
--with-integration Run all unit + integration tests
--with-slow-integration Run all unit + slow integration tests
--only-integration Only run integration tests
--only-slow-integration Only run slow integration tests


  • Publish to PyPi

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pytest_extra_markers-1.0.0-py3-none-any.whl (15.0 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