diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index cae2ae4a9..c28d90b5e 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -881,7 +881,9 @@ class Testdir: sys.stdout.write(out) sys.stderr.write(err) - res = RunResult(reprec.ret, out.split("\n"), err.split("\n"), time.time() - now) + res = RunResult( + reprec.ret, out.splitlines(), err.splitlines(), time.time() - now + ) res.reprec = reprec return res diff --git a/testing/test_config.py b/testing/test_config.py index 0264b029d..d4d624348 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -1291,7 +1291,7 @@ def test_config_blocked_default_plugins(testdir, plugin): if plugin != "terminal": result.stdout.fnmatch_lines(["* 1 failed in *"]) else: - assert result.stdout.lines == [""] + assert result.stdout.lines == [] class TestSetupCfg: diff --git a/testing/test_runner.py b/testing/test_runner.py index d2ce5d0bc..86e9bddff 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -597,7 +597,7 @@ def test_pytest_exit_returncode(testdir): result = testdir.runpytest() result.stdout.fnmatch_lines(["*! *Exit: some exit msg !*"]) - assert _strip_resource_warnings(result.stderr.lines) == [""] + assert _strip_resource_warnings(result.stderr.lines) == [] assert result.ret == 99 # It prints to stderr also in case of exit during pytest_sessionstart. @@ -612,8 +612,7 @@ def test_pytest_exit_returncode(testdir): result = testdir.runpytest() result.stdout.fnmatch_lines(["*! *Exit: during_sessionstart !*"]) assert _strip_resource_warnings(result.stderr.lines) == [ - "Exit: during_sessionstart", - "", + "Exit: during_sessionstart" ] assert result.ret == 98