pytest-timestamper is a pytest plugin that enhances test output by adding a timestamp prefix to each line of the test session output. This helps users track the duration of individual tests and overall test suite progress. The current version is 0.0.10, with releases occurring periodically to maintain compatibility with `pytest` and address minor improvements.
pip install pytest-timestamperVerified import paths — ran on the pinned version, not inferred.
Create a simple test file (e.g., `test_timestamps.py`) and run pytest. The plugin will automatically add timestamps. You can customize the timestamp format using `--prefixfmt` and `--datefmt` command-line options.
Upgrade to the latest version of `pytest-timestamper` (`0.0.10` or newer) to ensure compatibility with recent `pytest` versions.
To include timestamps within captured log output, configure Python's `logging` module with `%(asctime)s` in its format string and potentially adjust `pytest`'s log capture settings (e.g., `--show-capture=no` or custom `pytest_logger` hooks) if standard `logging` output is still not as expected. This plugin focuses on prefixing the main pytest output lines.
Ensure you install only `pytest-timestamper` if you intend to use its specific features, and review its documentation for usage. Avoid installing both `pytest-timestamper` and `pytest-timestamps` simultaneously unless their compatibility is explicitly confirmed.