Skip to content

Commit 4e1f8b9

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent ba4263d commit 4e1f8b9

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/_pytest/assertion/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init__(self, config: Config, mode) -> None:
112112
@property
113113
def rootpath(self):
114114
"""
115-
get current root path (current working dir)
115+
Get current root path (current working dir)
116116
"""
117117
try:
118118
return os.getcwd()

testing/test_assertrewrite.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,7 @@ def hook(
18831883
if PathFinder.find_spec has been called.
18841884
"""
18851885
import importlib.machinery
1886+
18861887
self.find_spec_calls: list[str] = []
18871888
self.initial_paths: set[Path] = set()
18881889

@@ -1956,7 +1957,6 @@ def test_simple_failure():
19561957
assert hook.find_spec("file") is not None
19571958
assert self.find_spec_calls == ["file"]
19581959

1959-
19601960
def test_assert_rewrites_only_rootpath(
19611961
self, pytester: Pytester, hook: AssertionRewritingHook, monkeypatch
19621962
) -> None:
@@ -1976,12 +1976,11 @@ def test_simple_failure():
19761976

19771977
rootpath = f"{os.getcwd()}/tests"
19781978
if not os.path.exists(rootpath):
1979-
mkdir(rootpath)
1979+
mkdir(rootpath)
19801980
monkeypatch.chdir(rootpath)
19811981
with mock.patch.object(hook, "fnpats", ["*.py"]):
19821982
assert hook.find_spec("file") is None
19831983

1984-
19851984
def test_assert_rewrite_correct_for_conftfest(
19861985
self, pytester: Pytester, hook: AssertionRewritingHook, monkeypatch
19871986
) -> None:
@@ -1998,12 +1997,11 @@ def fix(): return 1
19981997

19991998
rootpath = f"{os.getcwd()}/tests"
20001999
if not os.path.exists(rootpath):
2001-
mkdir(rootpath)
2000+
mkdir(rootpath)
20022001
monkeypatch.chdir(rootpath)
20032002

20042003
with mock.patch.object(hook, "fnpats", ["*.py"]):
20052004
assert hook.find_spec("conftest") is not None
2006-
20072005

20082006
def test_assert_rewrite_correct_for_plugins(
20092007
self, pytester: Pytester, hook: AssertionRewritingHook, monkeypatch
@@ -2024,12 +2022,11 @@ def test_assert_rewrite_correct_for_plugins(
20242022
hook.mark_rewrite("plugin")
20252023
rootpath = f"{os.getcwd()}/tests"
20262024
if not os.path.exists(rootpath):
2027-
mkdir(rootpath)
2025+
mkdir(rootpath)
20282026
monkeypatch.chdir(rootpath)
20292027
with mock.patch.object(hook, "fnpats", ["*.py"]):
20302028
assert hook.find_spec("plugin") is not None
20312029

2032-
20332030
@pytest.mark.skipif(
20342031
sys.platform.startswith("win32"), reason="cannot remove cwd on Windows"
20352032
)

0 commit comments

Comments
 (0)