summaryrefslogtreecommitdiff
path: root/testing/test_config.py
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-12-11 13:40:37 +0200
committerRan Benita <ran@unusedvar.com>2020-12-12 17:33:28 +0200
commited658d682961a602305112bee72aa1e8843479f2 (patch)
tree80f6866b6be21ab1e7298d1e2a0183da863345b2 /testing/test_config.py
parent902739cfc3bbc3379e6ef99c8e250de35f52ecde (diff)
downloadpytest-ed658d682961a602305112bee72aa1e8843479f2.tar.gz
Some py.path.local -> pathlib.Path
- Some conftest related functions - _confcutdir - Allow arbitrary os.PathLike[str] in gethookproxy.
Diffstat (limited to 'testing/test_config.py')
-rw-r--r--testing/test_config.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/testing/test_config.py b/testing/test_config.py
index b931797d4..eacc9c9eb 100644
--- a/testing/test_config.py
+++ b/testing/test_config.py
@@ -574,16 +574,16 @@ class TestConfigAPI:
config.getvalue("x")
assert config.getoption("x", 1) == 1
- def test_getconftest_pathlist(self, pytester: Pytester, tmpdir) -> None:
- somepath = tmpdir.join("x", "y", "z")
- p = tmpdir.join("conftest.py")
- p.write("pathlist = ['.', %r]" % str(somepath))
+ def test_getconftest_pathlist(self, pytester: Pytester, tmp_path: Path) -> None:
+ somepath = tmp_path.joinpath("x", "y", "z")
+ p = tmp_path.joinpath("conftest.py")
+ p.write_text(f"pathlist = ['.', {str(somepath)!r}]")
config = pytester.parseconfigure(p)
- assert config._getconftest_pathlist("notexist", path=tmpdir) is None
- pl = config._getconftest_pathlist("pathlist", path=tmpdir) or []
+ assert config._getconftest_pathlist("notexist", path=tmp_path) is None
+ pl = config._getconftest_pathlist("pathlist", path=tmp_path) or []
print(pl)
assert len(pl) == 2
- assert pl[0] == tmpdir
+ assert pl[0] == tmp_path
assert pl[1] == somepath
@pytest.mark.parametrize("maybe_type", ["not passed", "None", '"string"'])
@@ -1935,10 +1935,10 @@ class TestPytestPluginsVariable:
assert msg not in res.stdout.str()
-def test_conftest_import_error_repr(tmpdir: py.path.local) -> None:
+def test_conftest_import_error_repr(tmp_path: Path) -> None:
"""`ConftestImportFailure` should use a short error message and readable
path to the failed conftest.py file."""
- path = tmpdir.join("foo/conftest.py")
+ path = tmp_path.joinpath("foo/conftest.py")
with pytest.raises(
ConftestImportFailure,
match=re.escape(f"RuntimeError: some error (from {path})"),