Pytest Timestamper

0.0.10 · active · verified Thu Apr 16

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.

Common errors

Warnings

Install

Imports

Quickstart

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"

view raw JSON →