Skip to content

Commit 16f3fc9

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5efcb78 commit 16f3fc9

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
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: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,7 @@ def hook(
18821882
if PathFinder.find_spec has been called.
18831883
"""
18841884
import importlib.machinery
1885+
18851886
self.find_spec_calls: list[str] = []
18861887
self.initial_paths: set[Path] = set()
18871888

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

1958-
19591959
def test_assert_rewrites_only_rootpath(
19601960
self, pytester: Pytester, hook: AssertionRewritingHook, monkeypatch
19611961
) -> None:
@@ -1975,12 +1975,11 @@ def test_simple_failure():
19751975

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

1983-
19841983
def test_assert_correct_for_conftfest(
19851984
self, pytester: Pytester, hook: AssertionRewritingHook, monkeypatch
19861985
) -> None:
@@ -1997,12 +1996,11 @@ def fix(): return 1
19971996

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

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

20072005
def test_assert_excluded_rewrite_for_plugins(
20082006
self, pytester: Pytester, hook: AssertionRewritingHook, monkeypatch
@@ -2025,7 +2023,6 @@ def test_assert_excluded_rewrite_for_plugins(
20252023
with mock.patch.object(hook, "fnpats", ["*.py"]):
20262024
assert hook.find_spec("plugin") is not None
20272025

2028-
20292026
@pytest.mark.skipif(
20302027
sys.platform.startswith("win32"), reason="cannot remove cwd on Windows"
20312028
)

0 commit comments

Comments
 (0)