@@ -1883,6 +1883,7 @@ def hook(
1883
1883
if PathFinder.find_spec has been called.
1884
1884
"""
1885
1885
import importlib .machinery
1886
+
1886
1887
self .find_spec_calls : list [str ] = []
1887
1888
self .initial_paths : set [Path ] = set ()
1888
1889
@@ -1956,7 +1957,6 @@ def test_simple_failure():
1956
1957
assert hook .find_spec ("file" ) is not None
1957
1958
assert self .find_spec_calls == ["file" ]
1958
1959
1959
-
1960
1960
def test_assert_rewrites_only_rootpath (
1961
1961
self , pytester : Pytester , hook : AssertionRewritingHook , monkeypatch
1962
1962
) -> None :
@@ -1976,12 +1976,11 @@ def test_simple_failure():
1976
1976
1977
1977
rootpath = f"{ os .getcwd ()} /tests"
1978
1978
if not os .path .exists (rootpath ):
1979
- mkdir (rootpath )
1979
+ mkdir (rootpath )
1980
1980
monkeypatch .chdir (rootpath )
1981
1981
with mock .patch .object (hook , "fnpats" , ["*.py" ]):
1982
1982
assert hook .find_spec ("file" ) is None
1983
1983
1984
-
1985
1984
def test_assert_rewrite_correct_for_conftfest (
1986
1985
self , pytester : Pytester , hook : AssertionRewritingHook , monkeypatch
1987
1986
) -> None :
@@ -1998,12 +1997,11 @@ def fix(): return 1
1998
1997
1999
1998
rootpath = f"{ os .getcwd ()} /tests"
2000
1999
if not os .path .exists (rootpath ):
2001
- mkdir (rootpath )
2000
+ mkdir (rootpath )
2002
2001
monkeypatch .chdir (rootpath )
2003
2002
2004
2003
with mock .patch .object (hook , "fnpats" , ["*.py" ]):
2005
2004
assert hook .find_spec ("conftest" ) is not None
2006
-
2007
2005
2008
2006
def test_assert_rewrite_correct_for_plugins (
2009
2007
self , pytester : Pytester , hook : AssertionRewritingHook , monkeypatch
@@ -2024,12 +2022,11 @@ def test_assert_rewrite_correct_for_plugins(
2024
2022
hook .mark_rewrite ("plugin" )
2025
2023
rootpath = f"{ os .getcwd ()} /tests"
2026
2024
if not os .path .exists (rootpath ):
2027
- mkdir (rootpath )
2025
+ mkdir (rootpath )
2028
2026
monkeypatch .chdir (rootpath )
2029
2027
with mock .patch .object (hook , "fnpats" , ["*.py" ]):
2030
2028
assert hook .find_spec ("plugin" ) is not None
2031
2029
2032
-
2033
2030
@pytest .mark .skipif (
2034
2031
sys .platform .startswith ("win32" ), reason = "cannot remove cwd on Windows"
2035
2032
)
0 commit comments