Live Rich-rendered step trees in pytest terminal output
Project description
pytest-step-logger
Live, colour-coded step trees in your pytest terminal — powered by Rich.
⟳ test_checkout
├── ✔ Create booking 3.01s
├── ▶ Call API 1.24s ← running right now
└── ○ Validate response ← pending
Steps transition in real time:
| Symbol | Colour | Meaning |
|---|---|---|
○ |
grey | Not yet reached |
▶ |
yellow | Currently running |
✔ |
green | Passed |
✘ |
red | Failed |
Features
- Allure support — step labels come from
@allure.step("label")when available. - Plain-function fallback — when there is no allure, function names are used automatically (via
sys.settrace). - Ahead-of-time tree — all steps appear as grey nodes before execution starts, so you see the full plan upfront.
- Soft-assertion aware — failures from pytest-check are detected and colour the step red even though no exception propagates.
- Caught-exception fix — a step that catches and swallows an exception is correctly left green.
- pytest-xdist parallel support — a single persistent spinner panel shows every currently-running test with elapsed times; completed trees print above the panel without flicker.
Installation
pip install pytest-step-logger
With optional integrations:
# allure + pytest-check + xdist all at once
pip install "pytest-step-logger[all]"
# individual extras
pip install "pytest-step-logger[allure]"
pip install "pytest-step-logger[check]"
pip install "pytest-step-logger[xdist]"
Usage
Add --step-log to your pytest invocation:
pytest --step-log
Or make it permanent in pyproject.toml / pytest.ini:
[tool.pytest.ini_options]
addopts = "--step-log"
With allure steps
import allure
@allure.step("Create booking")
def create_booking():
...
@allure.step("Call API")
def call_api():
...
def test_checkout():
create_booking()
call_api()
With plain functions (no allure)
def create_booking():
...
def call_api():
...
def test_checkout():
create_booking()
call_api()
The plugin automatically detects the absence of allure and falls back to function names.
Parallel execution (pytest-xdist)
pytest --step-log -n auto
While tests run in parallel you see a live spinner panel:
⠋ test_checkout 2.3s
⠙ test_cancel_booking 1.1s
⠹ test_search 0.4s
As each test finishes its full step tree is printed above the panel.
How it works
| Scenario | Step source | Live display |
|---|---|---|
| Sequential, allure | @allure.step hook via allure_commons.plugin_manager |
Per-test Live tree |
| Sequential, no allure | sys.settrace call/return events |
Per-test Live tree |
| xdist worker | Same as above (no TTY needed) | None — serialised to report |
| xdist controller | Deserialises worker reports | Persistent spinner + printed trees |
Step records are serialised as JSON into report.user_properties and survive xdist's wire protocol transparently.
Requirements
- Python ≥ 3.11
- pytest ≥ 7.0
- rich ≥ 13.0
Optional:
- allure-pytest ≥ 2.13
- pytest-check ≥ 2.7.4
- pytest-xdist ≥ 3.8.0
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_step_logger-0.1.0.tar.gz.
File metadata
- Download URL: pytest_step_logger-0.1.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b03f63229157c4fb223d226e27c60e43b31c67da463c375ce6341c76016c0c6
|
|
| MD5 |
71e8550fcfb39cefe360f18857912883
|
|
| BLAKE2b-256 |
fc8177015803ebe609e42ea03122ebb802387a5c024e42b8506611d3ea389c3f
|
Provenance
The following attestation bundles were made for pytest_step_logger-0.1.0.tar.gz:
Publisher:
publish.yml on Slaaayer/pytest-step-logger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_step_logger-0.1.0.tar.gz -
Subject digest:
3b03f63229157c4fb223d226e27c60e43b31c67da463c375ce6341c76016c0c6 - Sigstore transparency entry: 1080451794
- Sigstore integration time:
-
Permalink:
Slaaayer/pytest-step-logger@e51e2953873cd7d89ad67fa9fe39536c401afb3a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Slaaayer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e51e2953873cd7d89ad67fa9fe39536c401afb3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file pytest_step_logger-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytest_step_logger-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58030843bab28ded3fba520b22163add0900ea54f8c7ae0a418b13bb0b6d05cb
|
|
| MD5 |
ba8fe41e3cbf73412d052f2192096aae
|
|
| BLAKE2b-256 |
1df35c3ed0998565f74f5602799f47948b0aa20cc5ff601107bca46430c8699e
|
Provenance
The following attestation bundles were made for pytest_step_logger-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Slaaayer/pytest-step-logger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_step_logger-0.1.0-py3-none-any.whl -
Subject digest:
58030843bab28ded3fba520b22163add0900ea54f8c7ae0a418b13bb0b6d05cb - Sigstore transparency entry: 1080451858
- Sigstore integration time:
-
Permalink:
Slaaayer/pytest-step-logger@e51e2953873cd7d89ad67fa9fe39536c401afb3a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Slaaayer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e51e2953873cd7d89ad67fa9fe39536c401afb3a -
Trigger Event:
push
-
Statement type: