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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-explicit-0.1.0.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.4

File hashes

Hashes for pytest-explicit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 422913359a742a795d8db319a13286bc9e78e75c428852b58710114c12bb23c6
MD5 0ac353db798552ed3ecea0294d4c3742
BLAKE2b-256 57b4a7191ea524cb1f425081f589537f607a7836f51cd325ff2cae3e591f6f04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_explicit-0.1.0-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.4

File hashes

Hashes for pytest_explicit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac2e959bb9dd24e865198197ab86ba5f33e2020428036f64a4e4c7a5316a7f48
MD5 dd106884f6aedf25b08e61923bb50f72
BLAKE2b-256 7feef00900fc0ccd36922930249749d5b5d662e008ad49e850254eb1c5a81119

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