Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions changelog/13700.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`--junitxml` no longer prints the `generated xml file` summary at the end of the pytest session when `--quiet` is given.
7 changes: 5 additions & 2 deletions src/_pytest/junitxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,11 @@ def pytest_sessionfinish(self) -> None:
testsuites.append(suite_node)
logfile.write(ET.tostring(testsuites, encoding="unicode"))

def pytest_terminal_summary(self, terminalreporter: TerminalReporter) -> None:
terminalreporter.write_sep("-", f"generated xml file: {self.logfile}")
def pytest_terminal_summary(
self, terminalreporter: TerminalReporter, config: pytest.Config
) -> None:
if config.get_verbosity() >= 0:
terminalreporter.write_sep("-", f"generated xml file: {self.logfile}")

def add_global_property(self, name: str, value: object) -> None:
__tracebackhide__ = True
Expand Down
10 changes: 10 additions & 0 deletions testing/test_junitxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1822,3 +1822,13 @@ def test_func():
assert junit_logging == "no"
assert len(node.find_by_tag("system-err")) == 0
assert len(node.find_by_tag("system-out")) == 0


def test_no_message_quiet(pytester: Pytester) -> None:
"""Do not show the summary banner when --quiet is given (#13700)."""
pytester.makepyfile("def test(): pass")
result = pytester.runpytest("--junitxml=pytest.xml")
result.stdout.fnmatch_lines("* generated xml file: *")

result = pytester.runpytest("--junitxml=pytest.xml", "--quiet")
result.stdout.no_fnmatch_line("* generated xml file: *")
Loading