Mock the current directory.
(path: epath.PathLike)
| 56 | |
| 57 | @contextlib.contextmanager |
| 58 | def mock_cwd(path: epath.PathLike) -> Iterator[None]: |
| 59 | """Mock the current directory.""" |
| 60 | path = epath.Path(path) |
| 61 | assert path.exists() and path.is_dir() # Check given path is valid cwd dir |
| 62 | with mock.patch.object(os, 'getcwd', return_value=os.fspath(path)): |
| 63 | yield |
| 64 | |
| 65 | |
| 66 | def _build( |
no test coverage detected