Skip to content

Commit

Permalink
tests: fix test_repr_traceback_with_invalid_cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Jan 21, 2020
1 parent a52f791 commit bcd589b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions testing/code/test_excinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,14 +775,20 @@ def entry():
)
excinfo = pytest.raises(ValueError, mod.entry)

p = FormattedExcinfo()
p = FormattedExcinfo(abspath=False)

raised = 0

def raiseos():
raise OSError(2)
nonlocal raised
raised += 1
raise OSError(2, "custom_oserror")

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

def test_repr_excinfo_addouterr(self, importasmod, tw_mock):
mod = importasmod(
Expand Down

0 comments on commit bcd589b

Please sign in to comment.