2323from unittest import mock
2424import zipfile
2525
26- from mock .mock import Mock
27-
2826import _pytest ._code
2927from _pytest ._io .saferepr import DEFAULT_REPR_MAX_SIZE
3028from _pytest .assertion import util
@@ -1308,14 +1306,18 @@ def test_rootpath_base(self, pytester: Pytester, monkeypatch: MonkeyPatch) -> No
13081306 config = pytester .parseconfig ()
13091307 state = AssertionState (config , "rewrite" )
13101308 assert state .rootpath == str (config .invocation_params .dir )
1311- new_rootpath = str (pytester .path / "test" )
1309+ new_rootpath = str (pytester .path / "test" )
13121310 if not os .path .exists (new_rootpath ):
13131311 os .mkdir (new_rootpath )
1314- monkeypatch .setattr (config ,"invocation_params" , Config .InvocationParams (
1315- args = (),
1316- plugins = (),
1317- dir = Path (new_rootpath ),
1318- ))
1312+ monkeypatch .setattr (
1313+ config ,
1314+ "invocation_params" ,
1315+ Config .InvocationParams (
1316+ args = (),
1317+ plugins = (),
1318+ dir = Path (new_rootpath ),
1319+ ),
1320+ )
13191321 state = AssertionState (config , "rewrite" )
13201322 assert state .rootpath == new_rootpath
13211323
@@ -1325,7 +1327,6 @@ def test_rootpath_base(self, pytester: Pytester, monkeypatch: MonkeyPatch) -> No
13251327 @pytest .mark .skipif (
13261328 sys .platform .startswith ("sunos5" ), reason = "cannot remove cwd on Solaris"
13271329 )
1328-
13291330 def test_write_pyc (self , pytester : Pytester , tmp_path ) -> None :
13301331 from _pytest .assertion import AssertionState
13311332 from _pytest .assertion .rewrite import _write_pyc
@@ -2023,11 +2024,15 @@ def test_simple_failure():
20232024 rootpath = f"{ os .getcwd ()} /tests"
20242025 if not os .path .exists (rootpath ):
20252026 mkdir (rootpath )
2026- monkeypatch .setattr (pytester ._request .config ,"invocation_params" , Config .InvocationParams (
2027- args = (),
2028- plugins = (),
2029- dir = Path (rootpath ),
2030- ))
2027+ monkeypatch .setattr (
2028+ pytester ._request .config ,
2029+ "invocation_params" ,
2030+ Config .InvocationParams (
2031+ args = (),
2032+ plugins = (),
2033+ dir = Path (rootpath ),
2034+ ),
2035+ )
20312036 with mock .patch .object (hook , "fnpats" , ["*.py" ]):
20322037 assert hook .find_spec ("file" ) is None
20332038
@@ -2048,11 +2053,15 @@ def fix(): return 1
20482053 rootpath = f"{ os .getcwd ()} /tests"
20492054 if not os .path .exists (rootpath ):
20502055 mkdir (rootpath )
2051- monkeypatch .setattr (pytester ._request .config ,"invocation_params" , Config .InvocationParams (
2052- args = (),
2053- plugins = (),
2054- dir = Path (rootpath ),
2055- ))
2056+ monkeypatch .setattr (
2057+ pytester ._request .config ,
2058+ "invocation_params" ,
2059+ Config .InvocationParams (
2060+ args = (),
2061+ plugins = (),
2062+ dir = Path (rootpath ),
2063+ ),
2064+ )
20562065 with mock .patch .object (hook , "fnpats" , ["*.py" ]):
20572066 assert hook .find_spec ("conftest" ) is not None
20582067
@@ -2076,11 +2085,15 @@ def test_assert_rewrite_correct_for_plugins(
20762085 rootpath = f"{ os .getcwd ()} /tests"
20772086 if not os .path .exists (rootpath ):
20782087 mkdir (rootpath )
2079- monkeypatch .setattr (pytester ._request .config ,"invocation_params" , Config .InvocationParams (
2080- args = (),
2081- plugins = (),
2082- dir = Path (rootpath ),
2083- ))
2088+ monkeypatch .setattr (
2089+ pytester ._request .config ,
2090+ "invocation_params" ,
2091+ Config .InvocationParams (
2092+ args = (),
2093+ plugins = (),
2094+ dir = Path (rootpath ),
2095+ ),
2096+ )
20842097 with mock .patch .object (hook , "fnpats" , ["*.py" ]):
20852098 assert hook .find_spec ("plugin" ) is not None
20862099
0 commit comments