Skip to content

Commit 5efcb78

Browse files
committed
Merge remote-tracking branch 'origin/disable_assertion_rewriting_external_modules' into disable_assertion_rewriting_external_modules
# Conflicts: # testing/test_assertrewrite.py
2 parents ad5317b + 232ba33 commit 5efcb78

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/_pytest/assertion/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
from __future__ import annotations
55

6-
import os
76
from collections.abc import Generator
7+
import os
88
import sys
99
from typing import Any
1010
from typing import TYPE_CHECKING
@@ -122,6 +122,7 @@ def rootpath(self):
122122
# Ref: https://github.com/pytest-dev/py/pull/207
123123
return os.path.dirname(os.path.abspath(sys.argv[0]))
124124

125+
125126
def install_importhook(config: Config) -> rewrite.AssertionRewritingHook:
126127
"""Try to install the rewrite hook, raise SystemError if it fails."""
127128
config.stash[assertstate_key] = AssertionState(config, "rewrite")

src/_pytest/assertion/rewrite.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def find_spec(
133133

134134
return importlib.util.spec_from_file_location(
135135
name,
136-
fn ,
136+
fn,
137137
loader=self,
138138
submodule_search_locations=spec.submodule_search_locations,
139139
)
@@ -246,7 +246,6 @@ def _should_rewrite(self, name: str, fn: str, state: AssertionState) -> bool:
246246

247247
return self._is_marked_for_rewrite(name, state)
248248

249-
250249
def _is_marked_for_rewrite(self, name: str, state: AssertionState) -> bool:
251250
try:
252251
return self._marked_for_rewrite_cache[name]

0 commit comments

Comments
 (0)