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+
13import py
24import pytest
35import shutil
@@ -123,7 +125,7 @@ def test_failures_somewhere(self, pytester: pytest.Pytester) -> None:
123125 failures = control .runsession ()
124126 assert failures
125127 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]
127129 item_path .write_text ("def test_func():\n assert 1\n " )
128130 removepyc (item_path )
129131 topdir , failures = control .runsession ()[:2 ]
@@ -141,7 +143,11 @@ def test_func():
141143 control = RemoteControl (modcol .config )
142144 control .loop_once ()
143145 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+
145151 modcol_path .write_text (
146152 textwrap .dedent (
147153 """
@@ -173,7 +179,7 @@ def test_func():
173179 if PYTEST_GTE_7 :
174180 parent = modcol .path .parent .parent # type: ignore[attr-defined]
175181 else :
176- parent = Path (modcol .fspath .dirpath ().dirpath ())
182+ parent = Path (cast ( py . path . local , modcol .fspath ) .dirpath ().dirpath ())
177183 monkeypatch .chdir (parent )
178184 modcol .config .args = [
179185 str (Path (x ).relative_to (parent )) for x in modcol .config .args
You can’t perform that action at this time.
0 commit comments