pytest-dev / pytest-dev/pytest
Header loading text order
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
I'm trying to customize the test header:
$ pytest
=================================================================== test session starts ===================================================================
platform linux -- Python 3.10.13, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/ubuntu/pymapdl
configfile: pyproject.toml
testpaths: tests
plugins: cov-4.1.0, anyio-4.3.0, sphinx-0.6.0, pytest_pyvista-0.1.9, rerunfailures-14.0, memprof-0.2.0
by modifying this function:
@pytest.hookimpl(trylast=True)
def pytest_report_header(config, start_path, startdir):
return "Useful reports"
However the platform linux ... get always first, which is annoying, and, in my humble opinion, it is a bug.
$ pytest
=================================================================== test session starts ===================================================================
platform linux -- Python 3.10.13, pytest-8.1.1, pluggy-1.4.0
Useful reports
rootdir: /home/ubuntu/pymapdl
configfile: pyproject.toml
testpaths: tests
plugins: cov-4.1.0, anyio-4.3.0, sphinx-0.6.0, pytest_pyvista-0.1.9, rerunfailures-14.0, memprof-0.2.0
I'm happy to do a PR on this if this issue feedback is positive.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the pytest_report_header hook shown in the issue and the session-header output produced by the sample pytest invocation. Reproduce the ordering with a hook returning “Useful reports,” then inspect the header-generation path to determine how the platform line is positioned. Done means the custom header appears in the requested order and the existing header output remains covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100