{"id":27302,"library":"pytest-monitor","title":"pytest-monitor","description":"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.","status":"active","version":"1.6.6","language":"python","source_language":"en","source_url":"https://github.com/CFMTech/pytest-monitor","tags":["pytest","plugin","resource-monitoring","testing","performance"],"install":[{"cmd":"pip install pytest-monitor","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for resource monitoring","package":"psutil","optional":false}],"imports":[{"note":"The package provides a pytest plugin; no explicit import needed for basic use; import the module only if you need to access internal functions.","symbol":"pytest_monitor","correct":"import pytest_monitor"}],"quickstart":{"code":"# pytest automatically discovers and activates the plugin\n# Install: pip install pytest-monitor\n# Run tests with resource monitoring enabled by default\n# Example test file: test_example.py\ndef test_resource_usage():\n    import time\n    time.sleep(0.1)\n    assert True\n\n# Run: pytest --monitor=sqlite:///monitor.db test_example.py","lang":"python","description":"Basic usage: install, write a test, and run with the --monitor flag to record results into a SQLite database."},"warnings":[{"fix":"Upgrade Python to >=3.7 and pytest to >=6.0 when moving beyond 1.6.6.","message":"Version 1.6.6 is the last to support Python 3.6 and older, and pytest 5.* and older.","severity":"breaking","affected_versions":">=1.6.6 (future versions will drop support)"},{"fix":"Use --monitor-server instead of --send-results.","message":"The option --send-results has been renamed to --monitor-server to avoid collisions on Windows.","severity":"deprecated","affected_versions":">=1.5.1"},{"fix":"Upgrade to 1.6.0 or later, or exclude doctests from monitoring.","message":"Doctests cause pytest-monitor to crash if monitoring is enabled. The plugin now automatically disables monitoring for doctests, but older versions may fail.","severity":"gotcha","affected_versions":"<1.6.0"},{"fix":"Set CPU_FREQUENCY env var (e.g., export CPU_FREQUENCY=2400) or upgrade to 1.6.5+ if possible.","message":"If psutil cannot fetch CPU frequency, the plugin may crash. Set environment variable CPU_FREQUENCY to a fallback value.","severity":"gotcha","affected_versions":"<=1.6.4"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install with 'pip install pytest-monitor'. The import is not needed; the plugin is auto-discovered.","cause":"The user tries to import pytest_monitor explicitly but the package may not be installed or they missed the underscore.","error":"ModuleNotFoundError: No module named 'pytest_monitor'"},{"fix":"Ensure pytest-monitor is installed (pip list | grep pytest-monitor) and that you are running pytest from the correct environment.","cause":"Using --monitor flag without the plugin installed or activated.","error":"pytest: error: unrecognized arguments: --monitor"},{"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.","cause":"psutil fails to get CPU frequency on some systems.","error":"pytest_monitor.plugin.MonitoringException: Unable to retrieve CPU frequency"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}