Merge pull request #6041 from blueyed/pytester-splitlines

pytester: runpytest_inprocess: use splitlines()
This commit is contained in:
Daniel Hahler 2019-10-23 21:42:21 +02:00 committed by GitHub
commit 6242777818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -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:

View File

@ -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