Skip to main content

A Pytest plugin to ignore certain marked tests by default

Project description

pytest-explicit

Some tests you just don't want to run

Hey, I get it. Sometimes we write tests, but we don't actually want to wait for them to finish executing. Whether they're slow tests, they need some dependencies you don't have, or they aren't related to the work you do, there's some tests that just weren't meant to be run by devs in the age of CI/CD platforms. That's where pytest-explicit comes in.

This plugin allows developers to specify test markers that should be ignored by default when running pytest, but also quickly bypass this behaviour for CI/CD. Just add a --run-all flag to your pytest command for your test pipeline, and this plugin won't skip anything!

Configuring

If all you want to do is skip slow tests by default, you can stop reading now. Out-of-the-box, pytest-explicit will make any test marked slow require you to pass the --run-slow (or --run-all) for them to take up precious developer time.

Need more ignored tests? Just add the explicit-only option to your pytest config file, and pytest-explicit will pick up the markers specified and dynamically add --run-<marker> CLI options to pytest. Here's a sample setup.cfg file below!

[tool:pytest]
markers =
    slow: Marks a slow test
    memory_intensive: Marks a test that needs at least 16 gb RAM to run
    smoke: Marks a test that gives early alert to the health of the app
testpaths = tests
explicit-only =
    slow
    memory_intensive

With this configuration file, any test marked with either slow or memory_intensive won't run unless the appropriate CLI flags are passed!

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-explicit-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

pytest_explicit-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file pytest-explicit-0.1.1.tar.gz.

File metadata

  • Download URL: pytest-explicit-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for pytest-explicit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5fd247d4f899c51fb3044ddfa4e7751720813bcf3f27322cd402ca0d60f95f8f
MD5 e1abe0e8b7738f55a7753fe4d88f0217
BLAKE2b-256 3b8a2041df159c7e684edbbc0d382249a63413cc9c90bd2f41e5e730fa9fd3c8

See more details on using hashes here.

File details

Details for the file pytest_explicit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_explicit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for pytest_explicit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1f82a5c1df105acdc9596cb5ed288f1c58f447b528202edafc34a50e25f34062
MD5 55293bfe1a0672dffdeefcb369a66164
BLAKE2b-256 7f4a373ded90e9be5f4c1e0225286eb2dd37a045e42ba27755a68b8f312216f8

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