23
23
from unittest import mock
24
24
import zipfile
25
25
26
- from mock .mock import Mock
27
-
28
26
import _pytest ._code
29
27
from _pytest ._io .saferepr import DEFAULT_REPR_MAX_SIZE
30
28
from _pytest .assertion import util
@@ -1308,14 +1306,18 @@ def test_rootpath_base(self, pytester: Pytester, monkeypatch: MonkeyPatch) -> No
1308
1306
config = pytester .parseconfig ()
1309
1307
state = AssertionState (config , "rewrite" )
1310
1308
assert state .rootpath == str (config .invocation_params .dir )
1311
- new_rootpath = str (pytester .path / "test" )
1309
+ new_rootpath = str (pytester .path / "test" )
1312
1310
if not os .path .exists (new_rootpath ):
1313
1311
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
+ )
1319
1321
state = AssertionState (config , "rewrite" )
1320
1322
assert state .rootpath == new_rootpath
1321
1323
@@ -1325,7 +1327,6 @@ def test_rootpath_base(self, pytester: Pytester, monkeypatch: MonkeyPatch) -> No
1325
1327
@pytest .mark .skipif (
1326
1328
sys .platform .startswith ("sunos5" ), reason = "cannot remove cwd on Solaris"
1327
1329
)
1328
-
1329
1330
def test_write_pyc (self , pytester : Pytester , tmp_path ) -> None :
1330
1331
from _pytest .assertion import AssertionState
1331
1332
from _pytest .assertion .rewrite import _write_pyc
@@ -2023,11 +2024,15 @@ def test_simple_failure():
2023
2024
rootpath = f"{ os .getcwd ()} /tests"
2024
2025
if not os .path .exists (rootpath ):
2025
2026
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
+ )
2031
2036
with mock .patch .object (hook , "fnpats" , ["*.py" ]):
2032
2037
assert hook .find_spec ("file" ) is None
2033
2038
@@ -2048,11 +2053,15 @@ def fix(): return 1
2048
2053
rootpath = f"{ os .getcwd ()} /tests"
2049
2054
if not os .path .exists (rootpath ):
2050
2055
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
+ )
2056
2065
with mock .patch .object (hook , "fnpats" , ["*.py" ]):
2057
2066
assert hook .find_spec ("conftest" ) is not None
2058
2067
@@ -2076,11 +2085,15 @@ def test_assert_rewrite_correct_for_plugins(
2076
2085
rootpath = f"{ os .getcwd ()} /tests"
2077
2086
if not os .path .exists (rootpath ):
2078
2087
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
+ )
2084
2097
with mock .patch .object (hook , "fnpats" , ["*.py" ]):
2085
2098
assert hook .find_spec ("plugin" ) is not None
2086
2099
0 commit comments