Skip to content

Commit e3c1a3d

Browse files
committed
Remove redundant type casts
1 parent 14e1d80 commit e3c1a3d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

testing/test_looponfail.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import cast
2-
31
import py
42
import pytest
53
import shutil
@@ -125,7 +123,7 @@ def test_failures_somewhere(self, pytester: pytest.Pytester) -> None:
125123
failures = control.runsession()
126124
assert failures
127125
control.setup()
128-
item_path = item.path if PYTEST_GTE_7 else Path(cast(py.path.local, item.fspath)) # type: ignore[attr-defined]
126+
item_path = item.path if PYTEST_GTE_7 else Path(str(item.fspath)) # type: ignore[attr-defined]
129127
item_path.write_text("def test_func():\n assert 1\n")
130128
removepyc(item_path)
131129
topdir, failures = control.runsession()[:2]
@@ -146,7 +144,7 @@ def test_func():
146144
if PYTEST_GTE_7:
147145
modcol_path = modcol.path # type:ignore[attr-defined]
148146
else:
149-
modcol_path = Path(cast(py.path.local, modcol.fspath))
147+
modcol_path = Path(str(modcol.fspath))
150148

151149
modcol_path.write_text(
152150
textwrap.dedent(
@@ -179,7 +177,7 @@ def test_func():
179177
if PYTEST_GTE_7:
180178
parent = modcol.path.parent.parent # type: ignore[attr-defined]
181179
else:
182-
parent = Path(cast(py.path.local, modcol.fspath).dirpath().dirpath())
180+
parent = Path(modcol.fspath.dirpath().dirpath())
183181
monkeypatch.chdir(parent)
184182
modcol.config.args = [
185183
str(Path(x).relative_to(parent)) for x in modcol.config.args

0 commit comments

Comments
 (0)