Skip to content

Commit 7aa2240

Browse files
committed
testing/test_nodes: fix fake session to be more accurate
The type of _initialpaths is `FrozenSet[Path]`.
1 parent 042d12f commit 7aa2240

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

testing/test_nodes.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from pathlib import Path
12
from typing import cast
23
from typing import List
34
from typing import Type
@@ -69,23 +70,23 @@ def test():
6970

7071
def test__check_initialpaths_for_relpath() -> None:
7172
"""Ensure that it handles dirs, and does not always use dirname."""
72-
cwd = py.path.local()
73+
cwd = Path.cwd()
7374

7475
class FakeSession1:
75-
_initialpaths = [cwd]
76+
_initialpaths = frozenset({cwd})
7677

7778
session = cast(pytest.Session, FakeSession1)
7879

79-
assert nodes._check_initialpaths_for_relpath(session, cwd) == ""
80+
assert nodes._check_initialpaths_for_relpath(session, py.path.local(cwd)) == ""
8081

81-
sub = cwd.join("file")
82+
sub = cwd / "file"
8283

8384
class FakeSession2:
84-
_initialpaths = [cwd]
85+
_initialpaths = frozenset({cwd})
8586

8687
session = cast(pytest.Session, FakeSession2)
8788

88-
assert nodes._check_initialpaths_for_relpath(session, sub) == "file"
89+
assert nodes._check_initialpaths_for_relpath(session, py.path.local(sub)) == "file"
8990

9091
outside = py.path.local("/outside")
9192
assert nodes._check_initialpaths_for_relpath(session, outside) is None

0 commit comments

Comments
 (0)