Skip to content

Include TerminalReporter in reference docs #6649 #12661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 29, 2024

Conversation

soxofaan
Copy link
Contributor

@soxofaan soxofaan commented Jul 25, 2024

Closes #6649

  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits. Please uncheck this if you prefer to squash the commits yourself.
  • Add text like closes #XYZW to the PR description and/or commits (where XYZW is the issue number). See the github docs for more information.
  • Create a new changelog file in the changelog folder, with a name like <ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.
  • Add yourself to AUTHORS in alphabetical order.

@soxofaan soxofaan force-pushed the issue6649-terminalreporter-docs branch from d020e1b to e3a6c63 Compare July 25, 2024 16:31
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 25, 2024
@soxofaan
Copy link
Contributor Author

I'm wondering if I should/can add an import of TerminalReporter somewhere around

from _pytest.stash import StashKey
from _pytest.terminal import TestShortLogReport
from _pytest.tmpdir import TempPathFactory

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @soxofaan, thanks for the PR.

The TerminalReporter not being part of the docs is an oversight, given they are part of the signature of pytest_terminal_summary.

I'm wondering if I should/can add an import of TerminalReporter somewhere around

Yes we should also publish it as part of the public API: if it is used by a public hook, it should also be available from the pytest namespace.

Also the build failed with:

/home/docs/checkouts/readthedocs.org/user_builds/pytest/envs/12661/lib/python3.12/site-packages/_pytest/terminal.py:docstring of _pytest.terminal.TerminalReporter.build_summary_stats_line:11: WARNING: Definition list ends without a blank line; unexpected unindent. 

Probably just need to fix the docstring here:

pytest/src/_pytest/terminal.py

Lines 1342 to 1343 in 6c806b4

This function builds a list of the "parts" that make up for the text in that line, in
the example above it would be:

To:

         This function builds a list of the "parts" that make up for the text in that line, in
-        the example above it would be:
+        the example above it would be::

It is unfortunate that the entire terminal plugin is being passed along to this hook, but too late for this now so we might as well document it.

@RonnyPfannschmidt
Copy link
Member

In stoll hoping we can replace it,

It's api is from python 2.4 times and libraries more dedicated to the topic recently showed a much nicer variant (like rich)

@soxofaan
Copy link
Contributor Author

thanks for the feedback. All tests pass now

@soxofaan soxofaan requested a review from nicoddemus July 26, 2024 08:43
@nicoddemus
Copy link
Member

It's api is from python 2.4 times and libraries more dedicated to the topic recently showed a much nicer variant (like rich)

I know, let's hope we manage to eventually find the time (and will) to do that. 🤞

@nicoddemus
Copy link
Member

This while small should not be backported, as it is introducing a new public symbol, so it should happen in the next minor release.

@nicoddemus nicoddemus enabled auto-merge (squash) July 26, 2024 11:12
@nicoddemus
Copy link
Member

@RonnyPfannschmidt build_summary_stats_line now appears in the docs... want to mark it as private instead (using :private: in the docstring)?

@nicoddemus
Copy link
Member

(I have a local fix for the docs, will push shortly)

@nicoddemus nicoddemus disabled auto-merge July 26, 2024 14:52
@nicoddemus nicoddemus merged commit 7ce3222 into pytest-dev:main Jul 29, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc: TerminalReporter is not documented
3 participants