(simulate_mirror, mock_cache)
| 131 | |
| 132 | |
| 133 | def test_mirror_no_remote_access(simulate_mirror, mock_cache): |
| 134 | uri = "mirror://wheel" |
| 135 | exc = RuntimeError("test failed") |
| 136 | |
| 137 | assert str(mirror.LocalMirror.get_mirror_path()) == simulate_mirror |
| 138 | assert cache.MirrorFile.get_location() is not None |
| 139 | |
| 140 | handler = URIHandler.from_uri(uri) |
| 141 | paths = tuple(handler.get_paths()) |
| 142 | assert len(paths) > 0 |
| 143 | |
| 144 | for path in paths: |
| 145 | assert path.location.exists() |
| 146 | path = str(path.location) |
| 147 | assert not path.startswith(simulate_mirror) |
| 148 | |
| 149 | |
| 150 | with ExitStack() as stack: |
| 151 | # Mock any remote file access functionality to throw an exception |
| 152 | shutil_mock = stack.enter_context(mock.patch("aura.cache.shutil")) |
| 153 | shutil_mock.copyfile.side_effect = exc |
| 154 | fetch_mock = stack.enter_context(mock.patch("aura.cache.MirrorFile.fetch", side_effect=exc)) |
| 155 | |
| 156 | handler_cached = URIHandler.from_uri(uri) |
| 157 | paths_cached = tuple(handler_cached.get_paths()) |
| 158 | |
| 159 | assert paths == paths_cached |
| 160 | |
| 161 | |
| 162 | @mock.patch("aura.cache.get_cache_threshold") |
nothing calls this directly
no test coverage detected