mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-02 22:38:54 -06:00
fix: read file addresses in an offline run
This commit is contained in:
1 parent
0d0b6c54b7
commit
f161b0aefa
2 files changed
+11
-2
No files matched your search
@@ -385,10 +385,11 @@ def open_retrying(
|
||||
again in this process. What ends the attempts is raised as urllib gave
|
||||
it, except a host that does not resolve (GoneError) and a host muted
|
||||
earlier (RateLimitError). A run that fetches nothing (run_is_offline)
|
||||
raises OfflineError before anything goes out.
|
||||
raises OfflineError before anything goes out. A file: address is read
|
||||
from this machine and is never refused.
|
||||
"""
|
||||
url = request.full_url
|
||||
if run_is_offline():
|
||||
if run_is_offline() and request.type != "file":
|
||||
raise OfflineError(f"{url}: {OFFLINE_ENV} is set, nothing is fetched")
|
||||
host = urllib.parse.urlsplit(url).hostname or ""
|
||||
if host in _exhausted_hosts:
|
||||
|
||||
@@ -507,6 +507,14 @@ class TheOfflineSwitchHoldsAtTheGateway(unittest.TestCase):
|
||||
upstream.download("https://host/x", tests.scratch_dir(self) / "x")
|
||||
urlopen.assert_not_called()
|
||||
|
||||
def test_a_file_address_is_read_offline(self):
|
||||
"""A file: address is this machine's: refusing it made every test that
|
||||
serves a fixture through file:// fail once the guard moved into
|
||||
open_retrying."""
|
||||
held = tests.scratch_dir(self) / "held.txt"
|
||||
held.write_bytes(b"local")
|
||||
self.assertEqual(upstream.fetch_body(held.as_uri()), b"local")
|
||||
|
||||
def test_the_cache_answers_as_an_offline_run(self):
|
||||
cache = str(tests.scratch_dir(self))
|
||||
with mock.patch.object(upstream, "http_json", side_effect=_no_network), \
|
||||
|
||||
Reference in new issue
Block a user