Merge pull request #6579 from blueyed/pytester-makefile-joins-abspath

pytester: test for _makefile joining an absolute path
This commit is contained in:
Daniel Hahler 2020-01-29 00:58:43 +01:00 committed by GitHub
commit 8e1d59a8dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -710,3 +710,13 @@ def test_testdir_outcomes_with_multiple_errors(testdir):
result.assert_outcomes(error=2)
assert result.parseoutcomes() == {"error": 2}
def test_makefile_joins_absolute_path(testdir: Testdir) -> None:
absfile = testdir.tmpdir / "absfile"
if sys.platform == "win32":
with pytest.raises(OSError):
testdir.makepyfile(**{str(absfile): ""})
else:
p1 = testdir.makepyfile(**{str(absfile): ""})
assert str(p1) == (testdir.tmpdir / absfile) + ".py"