Registry / testing / pytest-timestamper

pytest-timestamper

JSON →
library0.0.10pypypiunverified

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-timestamper
INSTALL
IMPORT
SIG · PYTEST-TIMESTAMPER
P
pytest-timestamper
testingpythonv0.0.10
Install
1.5s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.0.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

pytest-timestamper
✓ No direct import is typically needed; the plugin activates automatically upon installation.
pytest plugins are discovered and loaded by the pytest framework when installed in the same environment, so explicit imports in test files are generally not required for activation.

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.

import pytest def test_example_one(): print("This is the first example test.") assert True def test_example_two(): print("This is the second example test.") assert 1 + 1 == 2 # To run this, save as 'test_timestamps.py' and execute in terminal: # pytest -v --prefixfmt="[%H:%M:%S]" --datefmt="%Y-%m-%d"
Debug
Known issues
breakingVersion 0.0.10 removed deprecated decorators. Older versions of `pytest-timestamper` might rely on internal `pytest` APIs that have since been deprecated or removed in newer `pytest` releases, potentially leading to breakage or unexpected behavior if not updated.
fix
Upgrade to the latest version of `pytest-timestamper` (`0.0.10` or newer) to ensure compatibility with recent `pytest` versions.
affects: <0.0.10
gotchaTimestamps added by `pytest-timestamper` apply to the overall test output, not necessarily to captured log messages (e.g., from `logging`). `pytest`'s default log capture mechanism often re-formats logs, which can strip custom timestamps from `logging` calls.
fix
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.
affects: All versions
gotchaThere is another plugin named `pytest-timestamps` which provides similar functionality but with different implementation and options. Users might confuse the two or accidentally install both.
fix
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.
affects: All versions
Upgrade
Version history
0.0.10latest on PyPI · released Mar 27, 2024
Audit
Dependencies
pytestrequiredThis is a plugin for pytest and requires pytest to function. Specific version compatibility depends on the pytest-timestamper version.
Agent activity
4 hits · last 30 days
node
4
Resources
pytest-timestamper — pip install pytest-timestamper · libregistry