Detect Test Environment
JSON →The `lib-detect-testenv` library provides utility functions to programmatically detect whether Python code is currently running within a test environment. It supports detection of `pytest`, `doctest` (including PyCharm's docrunner), and `setup.py test` execution contexts. The library also offers a Command Line Interface (CLI) for integration into shell scripts and CI/CD pipelines. The current version is 3.0.1, last released on December 15, 2025, indicating active maintenance.
Traffic · last 30 days ↓75% vs prev 7d
total hits 12
actors 4 distinct systems
last hit 2d ago AhrefsBot
top countries 🇩🇪 Germany · 🇳🇴 Norway · HK · 🇫🇷 France · 🇺🇸 United States
Resources
API endpoints
full doc /v1/registry/lib-detect-testenv
compatibility /v1/registry/lib-detect-testenv/compatibility