Some py.path.local -> pathlib.Path

This commit is contained in:
Ran Benita
2020-12-14 15:54:59 +02:00
parent cb8142b8ec
commit 2cb34a99cb
10 changed files with 84 additions and 94 deletions

View File

@@ -1,3 +1,4 @@
from typing import cast
from typing import List
from typing import Type
@@ -73,17 +74,21 @@ def test__check_initialpaths_for_relpath() -> None:
class FakeSession1:
_initialpaths = [cwd]
assert nodes._check_initialpaths_for_relpath(FakeSession1, cwd) == ""
session = cast(pytest.Session, FakeSession1)
assert nodes._check_initialpaths_for_relpath(session, cwd) == ""
sub = cwd.join("file")
class FakeSession2:
_initialpaths = [cwd]
assert nodes._check_initialpaths_for_relpath(FakeSession2, sub) == "file"
session = cast(pytest.Session, FakeSession2)
assert nodes._check_initialpaths_for_relpath(session, sub) == "file"
outside = py.path.local("/outside")
assert nodes._check_initialpaths_for_relpath(FakeSession2, outside) is None
assert nodes._check_initialpaths_for_relpath(session, outside) is None
def test_failure_with_changed_cwd(pytester: Pytester) -> None: