From e3c1a3de672393bc868d1703cb0bf08329618e55 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 10 Mar 2022 09:11:00 -0300 Subject: [PATCH] Remove redundant type casts --- testing/test_looponfail.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/testing/test_looponfail.py b/testing/test_looponfail.py index cd1cc43..c70b00f 100644 --- a/testing/test_looponfail.py +++ b/testing/test_looponfail.py @@ -1,5 +1,3 @@ -from typing import cast - import py import pytest import shutil @@ -125,7 +123,7 @@ class TestRemoteControl: failures = control.runsession() assert failures control.setup() - item_path = item.path if PYTEST_GTE_7 else Path(cast(py.path.local, item.fspath)) # type: ignore[attr-defined] + item_path = item.path if PYTEST_GTE_7 else Path(str(item.fspath)) # type: ignore[attr-defined] item_path.write_text("def test_func():\n assert 1\n") removepyc(item_path) topdir, failures = control.runsession()[:2] @@ -146,7 +144,7 @@ class TestRemoteControl: if PYTEST_GTE_7: modcol_path = modcol.path # type:ignore[attr-defined] else: - modcol_path = Path(cast(py.path.local, modcol.fspath)) + modcol_path = Path(str(modcol.fspath)) modcol_path.write_text( textwrap.dedent( @@ -179,7 +177,7 @@ class TestRemoteControl: if PYTEST_GTE_7: parent = modcol.path.parent.parent # type: ignore[attr-defined] else: - parent = Path(cast(py.path.local, modcol.fspath).dirpath().dirpath()) + parent = Path(modcol.fspath.dirpath().dirpath()) monkeypatch.chdir(parent) modcol.config.args = [ str(Path(x).relative_to(parent)) for x in modcol.config.args