split up report header lines

i found it painful to read crammed in a single line
thus rootdir, config file and testpaths now have own lines
This commit is contained in:
Ronny Pfannschmidt 2023-02-12 09:46:07 +01:00
parent 431ec6d34e
commit 407b330fe1
4 changed files with 11 additions and 12 deletions

View File

@ -0,0 +1 @@
Split the report header for ``rootdir``, ``config file`` and ``testpaths`` so each has its own line.

View File

@ -739,16 +739,14 @@ class TerminalReporter:
self.write_line(line)
def pytest_report_header(self, config: Config) -> List[str]:
line = "rootdir: %s" % config.rootpath
result = [f"rootdir: {config.rootpath}"]
if config.inipath:
line += ", configfile: " + bestrelpath(config.rootpath, config.inipath)
result.append("configfile: " + bestrelpath(config.rootpath, config.inipath))
if config.args_source == Config.ArgsSource.TESTPATHS:
testpaths: List[str] = config.getini("testpaths")
line += ", testpaths: {}".format(", ".join(testpaths))
result = [line]
result.append("testpaths: {}".format(", ".join(testpaths)))
plugininfo = config.pluginmanager.list_plugin_distinfo()
if plugininfo:

View File

@ -74,7 +74,7 @@ class TestParseIni:
% p1.name,
)
result = pytester.runpytest()
result.stdout.fnmatch_lines(["*, configfile: setup.cfg, *", "* 1 passed in *"])
result.stdout.fnmatch_lines(["configfile: setup.cfg", "* 1 passed in *"])
assert result.ret == 0
def test_append_parse_args(

View File

@ -909,7 +909,7 @@ class TestTerminalFunctional:
# with configfile
pytester.makeini("""[pytest]""")
result = pytester.runpytest()
result.stdout.fnmatch_lines(["rootdir: *test_header0, configfile: tox.ini"])
result.stdout.fnmatch_lines(["rootdir: *test_header0", "configfile: tox.ini"])
# with testpaths option, and not passing anything in the command-line
pytester.makeini(
@ -920,12 +920,12 @@ class TestTerminalFunctional:
)
result = pytester.runpytest()
result.stdout.fnmatch_lines(
["rootdir: *test_header0, configfile: tox.ini, testpaths: tests, gui"]
["rootdir: *test_header0", "configfile: tox.ini", "testpaths: tests, gui"]
)
# with testpaths option, passing directory in command-line: do not show testpaths then
result = pytester.runpytest("tests")
result.stdout.fnmatch_lines(["rootdir: *test_header0, configfile: tox.ini"])
result.stdout.fnmatch_lines(["rootdir: *test_header0", "configfile: tox.ini"])
def test_header_absolute_testpath(
self, pytester: Pytester, monkeypatch: MonkeyPatch
@ -944,9 +944,9 @@ class TestTerminalFunctional:
result = pytester.runpytest()
result.stdout.fnmatch_lines(
[
"rootdir: *absolute_testpath0, configfile: pyproject.toml, testpaths: {}".format(
tests
)
"rootdir: *absolute_testpath0",
"configfile: pyproject.toml",
f"testpaths: {tests}",
]
)