Skip to content

Commit 6a67526

Browse files
committed
13403: Disable assertion rewriting for external modules - refactor AssertionStatus
1 parent 5116841 commit 6a67526

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

testing/test_assertrewrite.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import inspect
1313
import marshal
1414
import os
15-
from os import mkdir
1615
from pathlib import Path
1716
import py_compile
1817
import re
@@ -1299,13 +1298,15 @@ def test_meta_path():
12991298
assert pytester.runpytest().ret == 0
13001299

13011300
def test_invocation_dir(self, pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
1302-
"""Test get invocation param afrom AssertionState"""
1301+
"""Test get invocation param from AssertionState"""
13031302
from _pytest.assertion import AssertionState
13041303

13051304
config = pytester.parseconfig()
13061305
state = AssertionState(config, "rewrite")
1306+
13071307
assert state.invocation_path == str(config.invocation_params.dir)
1308-
new_rootpath = str(pytester.path / "test")
1308+
1309+
new_rootpath = pytester.path / "test"
13091310
if not os.path.exists(new_rootpath):
13101311
os.mkdir(new_rootpath)
13111312
monkeypatch.setattr(
@@ -1314,11 +1315,11 @@ def test_invocation_dir(self, pytester: Pytester, monkeypatch: MonkeyPatch) -> N
13141315
Config.InvocationParams(
13151316
args=(),
13161317
plugins=(),
1317-
dir=Path(new_rootpath),
1318+
dir=new_rootpath,
13181319
),
13191320
)
13201321
state = AssertionState(config, "rewrite")
1321-
assert state.invocation_path == new_rootpath
1322+
assert state.invocation_path == str(new_rootpath)
13221323

13231324
@pytest.mark.skipif(
13241325
sys.platform.startswith("win32"), reason="cannot remove cwd on Windows"
@@ -2020,8 +2021,6 @@ def test_simple_failure():
20202021
assert hook.find_spec("file") is not None
20212022

20222023
invocation_path = f"{os.getcwd()}/tests"
2023-
if not os.path.exists(invocation_path):
2024-
mkdir(invocation_path)
20252024
monkeypatch.setattr(
20262025
pytester._request.config.stash[assertstate_key],
20272026
"invocation_path",

0 commit comments

Comments
 (0)