Skip to content

Commit bcd589b

Browse files
committed
tests: fix test_repr_traceback_with_invalid_cwd
1 parent a52f791 commit bcd589b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

testing/code/test_excinfo.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,14 +775,20 @@ def entry():
775775
)
776776
excinfo = pytest.raises(ValueError, mod.entry)
777777

778-
p = FormattedExcinfo()
778+
p = FormattedExcinfo(abspath=False)
779+
780+
raised = 0
779781

780782
def raiseos():
781-
raise OSError(2)
783+
nonlocal raised
784+
raised += 1
785+
raise OSError(2, "custom_oserror")
782786

783787
monkeypatch.setattr(os, "getcwd", raiseos)
784788
assert p._makepath(__file__) == __file__
789+
assert raised == 1
785790
p.repr_traceback(excinfo)
791+
assert raised >= 3 # typically 3, 5 on py38-windows
786792

787793
def test_repr_excinfo_addouterr(self, importasmod, tw_mock):
788794
mod = importasmod(

0 commit comments

Comments
 (0)