_pytest.terminal module¶
terminal reporting of the full testing process.
This is a good source for looking at the various reporting hooks.
-
class
MoreQuietAction(option_strings, dest, default=None, required=False, help=None)[source]¶ Bases:
argparse.Actiona modified copy of the argparse count action which counts down and updates the legacy quiet attribute at the same time
used to unify verbosity handling
-
pytest_configure(config: _pytest.config.Config) → None[source]¶
-
getreportopt(config: _pytest.config.Config) → str[source]¶
-
class
WarningReport(warning: warnings.WarningMessage, when: str, fslocation: Tuple[str, int], nodeid: Optional[str] = None)[source]¶ Bases:
objectHolds information for warnings captured by
TerminalReporter.pytest_warning_captured().-
warning¶ The original warning.
-
when¶ When the warning was captured, e.g. “config”, “collect”, or “runtest” (see
_pytest.hookspec.pytest_warning_captured()).
-
fslocation¶ Source of the warning (file system location, see
get_location()).
-
nodeid¶ Node id that generated the warning (see
get_location()).
-
count_towards_summary= True¶
-
message¶ Formatted warning (the standard way, without trailing newline).
-
source_line¶
-
get_location(config: _pytest.config.Config) → str[source]¶ Returns the more user-friendly information about the location of a warning.
-
-
class
TerminalReporter(config: _pytest.config.Config, file=None)[source]¶ Bases:
object-
_determine_show_progress_info()[source]¶ Return True if we should display progress information based on the current config
-
verbosity¶
-
showheader¶
-
showfspath¶
-
showlongtestinfo¶
-
rewrite(line, **markup)[source]¶ Rewinds the terminal cursor to the beginning and writes the given line.
- Parameters
erase – if True, will also add spaces until the full terminal width to ensure previous lines are properly erased.
The rest of the keyword arguments are markup instructions.
-
pytest_warning_captured(when: str, warning_message: warnings.WarningMessage, item: _pytest.nodes.Item) → None[source]¶
-
pytest_runtest_logreport(report: _pytest.reports.TestReport) → None[source]¶
-
_is_last_item¶
-
for ... in
pytest_runtestloop() → Generator[None, None, None][source]¶ Write final progress indicator.
-
_width_of_current_line¶ Return the width of current line, using the superior implementation of py-1.6 when available
-
pytest_collectreport(report: _pytest.reports.CollectReport) → None[source]¶
-
_verbose_collect_ignored() → List[str][source]¶ Get information about ignored files during collection.
-
pytest_sessionstart(session: _pytest.main.Session) → None[source]¶
-
pytest_report_header(config: _pytest.config.Config) → List[str][source]¶
-
for ... in
pytest_ignore_collect(path: py._path.local.LocalPath) → Generator[None, pluggy.callers._Result, None][source]¶ Register ignored files during collection for reporting.
-
_printcollecteditems(items: Sequence[_pytest.nodes.Item]) → None[source]¶
-
for ... in
pytest_sessionfinish(session: _pytest.main.Session, exitstatus: _pytest.config.ExitCode)[source]¶
-
pytest_keyboard_interrupt(excinfo: _pytest._code.code.ExceptionInfo) → None[source]¶
-
_get_teardown_reports(nodeid: str) → List[_pytest.reports.TestReport][source]¶
-
print_teardown_sections(rep: _pytest.reports.TestReport) → None[source]¶
-
-
_get_rep_reprcrash(rep: Union[_pytest.reports.CollectReport, _pytest.reports.TestReport], fulltrace: bool) → Optional[_pytest._code.code.ReprFileLocation][source]¶
-
_get_pos(config: _pytest.config.Config, rep: Union[_pytest.reports.CollectReport, _pytest.reports.TestReport]) → str[source]¶
-
_get_line_with_reprcrash_message(config: _pytest.config.Config, rep: Union[_pytest.reports.CollectReport, _pytest.reports.TestReport], termwidth: Optional[int]) → str[source]¶ Get summary line for a report, trying to add reprcrash message.