pytest-astropy-header
pytest plugin to add diagnostic information to the header of the test output
What it is and what it does
pytest-astropy-header is a pytest plugin that injects diagnostic metadata into test output headers. When enabled, it displays the current date, platform, Python version, encoding details, and versions of selected dependencies before tests run. This helps developers and CI systems quickly understand the environment in which tests executed, making it easier to reproduce issues or debug environment-specific failures.
The plugin is designed primarily for Astropy-affiliated projects but works with any pytest-based test suite. It can be enabled via conftest.py or setup.cfg, and supports customization of which packages appear in the header and what additional text to append. The single runtime dependency is pytest itself, making installation straightforward.
Use it for:
- Include system and dependency versions in CI/CD test logs for reproducibility and debugging
- Display Python environment details in test output when running tests locally or in containers
- Customize which package versions appear in test headers for Astropy-related projects
- Append custom diagnostic text to pytest output headers for project-specific metadata
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that automatically includes system, Python, and dependency version information in test output headers, useful for diagnosing test environments across any project.
Yes, if you run pytest and need environment diagnostics in test output. The plugin is lightweight, has no complex dependencies, and is actively maintained. Install it when you want test logs to automatically capture system and package version context without manual logging code.
Install
pytest-astropy-header on PyPI
pip
pip install pytest-astropy-headeruv
uv add pytest-astropy-headerpoetry
poetry add pytest-astropy-headerInstalling pytest-astropy-header
Before you install
Low friction installation as a pure-Python wheel with only pytest as a runtime dependency. Active maintenance with a recent commit on 2026-08-03, though the latest release was in 2022-09-06.
License in practice
BSD 3-Clause License (permissive) allows use in most projects without restriction, including commercial and proprietary software.
Quickstart
pip install pytest-astropy-header
# In conftest.py:
def pytest_configure(config):
config.option.astropy_header = True
Verify before relying
- Whether the plugin works with pytest versions beyond those tested in the fact sheet
- Performance impact when displaying many custom package versions
Package facts
| License | BSD 3-Clause License (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | actively maintained — 1,438 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 314,167/month — #7,705 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_astropy_header-0.2.2-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-astropyA meta-package that bundles pytest plugins and…
permissive · top 15,000 on PyPI
pytest-remotedataA pytest plugin that lets you mark and…
permissive · top 15,000 on PyPI
pytest-filter-subpackageA pytest plugin that adds a `-P` option to run…
permissive · top 15,000 on PyPI
pytest-mypyIntegrates mypy static type checking into…
permissive · top 15,000 on PyPI
asdf-astropyProvides ASDF serialization plugins for astropy…
unclear · top 15,000 on PyPI
pytest-helpers-namespaceProvides a pytest namespace for registering and…
permissive · top 15,000 on PyPI
PyAVMPyAVM reads, writes, and embeds Astronomy…
permissive · top 15,000 on PyPI
pytest-beartype-testsA pytest plugin that automatically applies…
permissive · top 15,000 on PyPI
pytest-jsonA pytest plugin that generates JSON reports of…
permissive · top 15,000 on PyPI