Skip to content

IS_RUNNING_TESTS config should also detect Pytest runner #2136

Closed
@paduszyk

Description

@paduszyk

One may presume that pytest so popular that it is used with Django projects as often as the built-in manage.py test framework (usually including plugins, e.g. pytest-django). However, the IS_RUNNING_TESTS setting detects only the latter by default by looking for "test" in sys.argv.

Updating:

"IS_RUNNING_TESTS": "test" in sys.argv,

by:

    "IS_RUNNING_TESTS": ("test" in sys.argv) or "PYTEST_VERSION" in os.environ,

NOTE: Using PYTEST_VERSION variable is a recommended way for determining whether pytest is running; see pytest-dev/pytest#9502 (comment).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions