summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2020-01-22 14:30:55 +0100
committerDaniel Hahler <git@thequod.de>2020-01-22 14:34:11 +0100
commitb8787b8732f7528efeebab9caa18a12bf556dddb (patch)
tree3b6bb9ac5a981d35e028538f3b46dd54b3c4bf39 /testing
parent0f78ef8e0294b6d141b26fc5e62ffa1c67bd7a2f (diff)
downloadpytest-b8787b8732f7528efeebab9caa18a12bf556dddb.tar.gz
tests: fix test_cwd_snapshot
Without restoring the cwd, successive tests might fail to parse the config (via `_pytest.config._prepareconfig()`, for when `--lsof` is used). And it is good practice to restore the cwd in any case anyway.
Diffstat (limited to 'testing')
-rw-r--r--testing/test_pytester.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/testing/test_pytester.py b/testing/test_pytester.py
index 6c8c933d7..869e35db3 100644
--- a/testing/test_pytester.py
+++ b/testing/test_pytester.py
@@ -16,6 +16,7 @@ from _pytest.pytester import HookRecorder
from _pytest.pytester import LineMatcher
from _pytest.pytester import SysModulesSnapshot
from _pytest.pytester import SysPathsSnapshot
+from _pytest.pytester import Testdir
def test_make_hook_recorder(testdir) -> None:
@@ -273,7 +274,8 @@ def test_assert_outcomes_after_pytest_error(testdir) -> None:
result.assert_outcomes(passed=0)
-def test_cwd_snapshot(tmpdir) -> None:
+def test_cwd_snapshot(testdir: Testdir) -> None:
+ tmpdir = testdir.tmpdir
foo = tmpdir.ensure("foo", dir=1)
bar = tmpdir.ensure("bar", dir=1)
foo.chdir()