Registry / testing / pytest-monitor

pytest-monitor

JSON →
library1.6.6pypypi✓ verified 87d ago

A pytest plugin for analyzing resource usage (CPU, memory, I/O) of tests. It records resource consumption and optionally sends results to a monitoring server. The current version is 1.6.6, with a maintenance cadence of a few releases per year.

pip install pytest-monitor
INSTALL
IMPORT
SIG · PYTEST-MONITOR
P
pytest-monitor
testingpythonv1.6.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_monitor
import pytest_monitor
The package provides a pytest plugin; no explicit import needed for basic use; import the module only if you need to access internal functions.

Basic usage: install, write a test, and run with the --monitor flag to record results into a SQLite database.

# pytest automatically discovers and activates the plugin # Install: pip install pytest-monitor # Run tests with resource monitoring enabled by default # Example test file: test_example.py def test_resource_usage(): import time time.sleep(0.1) assert True # Run: pytest --monitor=sqlite:///monitor.db test_example.py
pytest --version
Debug
Known issues
breakingVersion 1.6.6 is the last to support Python 3.6 and older, and pytest 5.* and older.
fix
Upgrade Python to >=3.7 and pytest to >=6.0 when moving beyond 1.6.6.
affects: >=1.6.6 (future versions will drop support)
deprecatedThe option --send-results has been renamed to --monitor-server to avoid collisions on Windows.
fix
Use --monitor-server instead of --send-results.
affects: >=1.5.1
gotchaDoctests cause pytest-monitor to crash if monitoring is enabled. The plugin now automatically disables monitoring for doctests, but older versions may fail.
fix
Upgrade to 1.6.0 or later, or exclude doctests from monitoring.
affects: <1.6.0
gotchaIf psutil cannot fetch CPU frequency, the plugin may crash. Set environment variable CPU_FREQUENCY to a fallback value.
fix
Set CPU_FREQUENCY env var (e.g., export CPU_FREQUENCY=2400) or upgrade to 1.6.5+ if possible.
affects: <=1.6.4
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pytest_monitor'
The user tries to import pytest_monitor explicitly but the package may not be installed or they missed the underscore.
fix
Install with 'pip install pytest-monitor'. The import is not needed; the plugin is auto-discovered.
pytest: error: unrecognized arguments: --monitor
Using --monitor flag without the plugin installed or activated.
fix
Ensure pytest-monitor is installed (pip list | grep pytest-monitor) and that you are running pytest from the correct environment.
pytest_monitor.plugin.MonitoringException: Unable to retrieve CPU frequency
psutil fails to get CPU frequency on some systems.
fix
Set the environment variable CPU_FREQUENCY to your CPU's frequency in MHz (e.g., export CPU_FREQUENCY=2400) or upgrade to 1.6.5+ where a fallback is handled.
Upgrade
Version history
1.6.6latest on PyPI · released Jun 25, 2023
Audit
Dependencies
psutilrequiredRequired for resource monitoring
Agent activity
30 hits · last 30 days
node
22
OpenAI (training)
2
Amazon
1
Bingbot
1
Resources
pytest-monitor — pip install pytest-monitor · libregistry