Skip to main content

pytest plugin providing a function to check if pytest is running.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

https://img.shields.io/github/workflow/status/adamchainz/pytest-is-running/CI/main?style=for-the-badge https://img.shields.io/pypi/v/pytest-is-running.svg?style=for-the-badge https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge pre-commit

pytest plugin providing a function to check if pytest is running.

Installation

Install with:

python -m pip install pytest-is-running

Python 3.6 to 3.10 supported.


Testing a Django project? Check out my book Speed Up Your Django Tests which covers loads of best practices so you can write faster, more accurate tests.


Usage

pytest will automatically find the plugin and use it when you run pytest. You can check if pytest is running with the is_running() function:

import pytest_is_running


if pytest_is_running.is_running():
    ...

The package avoids importing pytest if it is not running, so that you don’t incur that overhead in non-test paths.

The package registers its plugin hooks as early as possible in pytest’s process, so it should be loaded before any of your non-test modules.

Rationale

This plugin is an alternative to re-implementing the pattern in the Pytest documentation. As a plugin, it is loaded earlier than conftest.py or any other code in your project. This makes it a more robust way of checking whether Pytest is currently running.

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_is_running-1.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest-is-running-1.0.0.tar.gz.

File metadata

  • Download URL: pytest-is-running-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pytest-is-running-1.0.0.tar.gz
Algorithm Hash digest
SHA256 53ab6074c390a86f0937aae791845c81b79e7bd4fa8ab03d6a9cd65c5aad1ffa
MD5 5d4554a2c13989d9b5dafdca3a94865b
BLAKE2b-256 ef1b1da17646a061f960d04589fff35481bc975b383b610ecb90e13f7c8ce769

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_is_running-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pytest_is_running-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6af716d5baea4e12808e2c2dc7569bc47fda8a3da4a89e045939f0e653e1abd
MD5 5654adea81f130a90433ea44479150d6
BLAKE2b-256 3fd10175e50dda2d2804aff588c2e432b5d64e208de4d203ca691296c64c2437

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page