()
| 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__ |
nothing calls this directly
no outgoing calls
no test coverage detected