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/badge/Coverage-100%25-success?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.7 to 3.10 supported.


Working on a Django project? Check out my book Boost Your Django DX which covers many ways to improve your development experience. I created pytest-is-running whilst working on the book!


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.1.0.tar.gz (4.3 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.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-is-running-1.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for pytest-is-running-1.1.0.tar.gz
Algorithm Hash digest
SHA256 afa16a224467c048478007485e5e03598b3d7d4768163e95fb72120c47b0b33c
MD5 91fa60e22b847ccaf0595d2bdc0f2086
BLAKE2b-256 4b2bd4a2f0e06e2099b83024b63df8ffacfc60493848aa4fd347a727fb5099de

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_is_running-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for pytest_is_running-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f45eda8b42bdeac15118b03047c6379f09ed7a3f1e43bcc4011891c4a9575781
MD5 24fc62d0fc32cc33fc6abc745a81bc38
BLAKE2b-256 9827292c2edce3ea2e64b5fe24348ef9465c2bb8c07dcfb2b2281252a97abc87

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