MCPcopy Create free account
hub / github.com/pytest-dev/pytest / raiseos

Method raiseos

testing/code/test_excinfo.py:810–819  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

808 orig_path_cwd = Path.cwd
809
810 def raiseos():
811 nonlocal raised
812 upframe = sys._getframe().f_back
813 assert upframe is not None
814 if upframe.f_code.co_name == "_makepath":
815 # Only raise with expected calls, but not via e.g. inspect for
816 # py38-windows.
817 raised += 1
818 raise OSError(2, "custom_oserror")
819 return orig_path_cwd()
820
821 monkeypatch.setattr(Path, "cwd", raiseos)
822 assert p._makepath(Path(__file__)) == __file__

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected