Skip to main content

A Pytest plugin to ignore certain marked tests by default

Project description

pytest-explicit

pypi version python versions package state pypi release pypi downloads license

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

Uploaded Source

Built Distribution

pytest_explicit-1.0.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-explicit-1.0.0.tar.gz
  • Upload date:
  • Size: 4.3 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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 16f2c7ce0bd125860e00e16de413428849d202ef49e963c607389c2950d1273a
MD5 2c0bca161c3cd650f777fec0e39dd68e
BLAKE2b-256 e6aaccfbe88091ac1210f3f25597679f4037829e890119dbfb4aa3dd1d63af74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_explicit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 139db822f3f073fe5ce4ac1450df976d40545628da4a59c015043b419eae799f
MD5 82f6e32f4150b7839071ce6275050b2a
BLAKE2b-256 36ce3311717669b8785bbfd63923ce2aa9c2e68a5a47e12a80e8832927cbf5f3

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