12
12
import inspect
13
13
import marshal
14
14
import os
15
- from os import mkdir
16
15
from pathlib import Path
17
16
import py_compile
18
17
import re
@@ -1299,13 +1298,15 @@ def test_meta_path():
1299
1298
assert pytester .runpytest ().ret == 0
1300
1299
1301
1300
def test_invocation_dir (self , pytester : Pytester , monkeypatch : MonkeyPatch ) -> None :
1302
- """Test get invocation param afrom AssertionState"""
1301
+ """Test get invocation param from AssertionState"""
1303
1302
from _pytest .assertion import AssertionState
1304
1303
1305
1304
config = pytester .parseconfig ()
1306
1305
state = AssertionState (config , "rewrite" )
1306
+
1307
1307
assert state .invocation_path == str (config .invocation_params .dir )
1308
- new_rootpath = str (pytester .path / "test" )
1308
+
1309
+ new_rootpath = pytester .path / "test"
1309
1310
if not os .path .exists (new_rootpath ):
1310
1311
os .mkdir (new_rootpath )
1311
1312
monkeypatch .setattr (
@@ -1314,11 +1315,11 @@ def test_invocation_dir(self, pytester: Pytester, monkeypatch: MonkeyPatch) -> N
1314
1315
Config .InvocationParams (
1315
1316
args = (),
1316
1317
plugins = (),
1317
- dir = Path ( new_rootpath ) ,
1318
+ dir = new_rootpath ,
1318
1319
),
1319
1320
)
1320
1321
state = AssertionState (config , "rewrite" )
1321
- assert state .invocation_path == new_rootpath
1322
+ assert state .invocation_path == str ( new_rootpath )
1322
1323
1323
1324
@pytest .mark .skipif (
1324
1325
sys .platform .startswith ("win32" ), reason = "cannot remove cwd on Windows"
@@ -2020,8 +2021,6 @@ def test_simple_failure():
2020
2021
assert hook .find_spec ("file" ) is not None
2021
2022
2022
2023
invocation_path = f"{ os .getcwd ()} /tests"
2023
- if not os .path .exists (invocation_path ):
2024
- mkdir (invocation_path )
2025
2024
monkeypatch .setattr (
2026
2025
pytester ._request .config .stash [assertstate_key ],
2027
2026
"invocation_path" ,
0 commit comments