File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change
1
+ from typing import cast
2
+
1
3
import py
2
4
import pytest
3
5
import shutil
@@ -123,7 +125,7 @@ def test_failures_somewhere(self, pytester: pytest.Pytester) -> None:
123
125
failures = control .runsession ()
124
126
assert failures
125
127
control .setup ()
126
- item_path = item .path if PYTEST_GTE_7 else Path (item .fspath ) # type: ignore[attr-defined]
128
+ item_path = item .path if PYTEST_GTE_7 else Path (cast ( py . path . local , item .fspath ) ) # type: ignore[attr-defined]
127
129
item_path .write_text ("def test_func():\n assert 1\n " )
128
130
removepyc (item_path )
129
131
topdir , failures = control .runsession ()[:2 ]
@@ -141,7 +143,11 @@ def test_func():
141
143
control = RemoteControl (modcol .config )
142
144
control .loop_once ()
143
145
assert control .failures
144
- modcol_path = modcol .path if PYTEST_GTE_7 else Path (modcol .fspath ) # type: ignore[attr-defined]
146
+ if PYTEST_GTE_7 :
147
+ modcol_path = modcol .path # type:ignore[attr-defined]
148
+ else :
149
+ modcol_path = Path (cast (py .path .local , modcol .fspath ))
150
+
145
151
modcol_path .write_text (
146
152
textwrap .dedent (
147
153
"""
@@ -173,7 +179,7 @@ def test_func():
173
179
if PYTEST_GTE_7 :
174
180
parent = modcol .path .parent .parent # type: ignore[attr-defined]
175
181
else :
176
- parent = Path (modcol .fspath .dirpath ().dirpath ())
182
+ parent = Path (cast ( py . path . local , modcol .fspath ) .dirpath ().dirpath ())
177
183
monkeypatch .chdir (parent )
178
184
modcol .config .args = [
179
185
str (Path (x ).relative_to (parent )) for x in modcol .config .args
You can’t perform that action at this time.
0 commit comments