Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-55594: Document unittest.TextTestRunner class and methods#142648

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
saivineethreddysuravi wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromsaivineethreddysuravi:gh-55594-texttestrunner-docs
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletionsDoc/library/unittest.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1999,6 +1999,48 @@ Loading and running tests
.. versionchanged:: 3.13
*top_level_dir* is only stored for the duration of *discover* call.


.. _testrunner-objects:

Test runners
~~~~~~~~~~~~

.. class:: TextTestRunner(stream=None, descriptions=True, verbosity=1,
warnings=None, *, resultclass=None)

A basic test runner implementation that outputs results to a stream.

This class has a few configurable parameters, controlling the output:

:param stream: The stream to which the test results are printed. By
default, this is ``sys.stderr``.
:param descriptions: Controls whether test descriptions are displayed.
Defaults to ``True``.
:param verbosity: Controls the verbosity level of the output. Higher
numbers mean more verbose output. Defaults to ``1``.
:param warnings: Controls how warnings are handled during the test run.
See the :mod:`warnings` module documentation for details.
Defaults to ``None``.
:param resultclass: The class to instantiate for test results. Defaults
to :class:`TextTestResult`.

.. versionchanged:: 3.1
Added `warnings` parameter.

.. versionchanged:: 3.2
Added `resultclass` parameter.

.. method:: run(test)

Run the given test case or test suite.

:param test: The :class:`TestCase` or :class:`TestSuite` object to run.
:returns: The :class:`TestResult` object produced by the test run.

This method is commonly used by :func:`unittest.main` to execute tests.
`unittest.main` will instantiate a :class:`TextTestRunner` and call its
`run()` method implicitly.

.. versionchanged:: 3.14
*start_dir* can once again be a :term:`namespace package`.

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp