Skip to content

Commit 44fa471

Browse files
committed
13403: Disable assertion rewriting for external modules
1 parent acf1303 commit 44fa471

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/_pytest/assertion/rewrite.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ def _early_rewrite_bailout(self, name: str, state: AssertionState) -> bool:
216216
if fnmatch_ex(pat, path):
217217
return False
218218

219+
rootPath=os.getcwd()
220+
if not path.is_relative_to(rootPath):
221+
return True
222+
219223
if self._is_marked_for_rewrite(name, state):
220224
return False
221225

0 commit comments

Comments
 (0)