test(scripts): reach the fake registry past Lint's dead proxy
Lint's fast path exports a dead proxy with an empty no_proxy, and next_image_version.py uses urllib's default opener, which honours them, so the RegistryClient tests could not reach their fake registry on 127.0.0.1. Setting no_proxy for loopback in the tests lets the suite run under the guard instead of the workflow unsetting it. Refs: #187 Assisted-by: Claude Code
This commit is contained in:
1 parent
6c80ab7772
commit
b2e547edd5
1 file changed
+8
@@ -6,11 +6,13 @@ import contextlib
|
|||||||
import http.server
|
import http.server
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
SCRIPTS = pathlib.Path(__file__).resolve().parents[2] / "scripts"
|
SCRIPTS = pathlib.Path(__file__).resolve().parents[2] / "scripts"
|
||||||
sys.path.insert(0, str(SCRIPTS))
|
sys.path.insert(0, str(SCRIPTS))
|
||||||
@@ -156,6 +158,12 @@ class QuietServer(http.server.HTTPServer):
|
|||||||
|
|
||||||
class RegistryClient(unittest.TestCase):
|
class RegistryClient(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
# Lint exports a dead proxy with an empty no_proxy; the fake registry is on loopback.
|
||||||
|
patcher = mock.patch.dict(
|
||||||
|
os.environ, no_proxy="127.0.0.1", NO_PROXY="127.0.0.1"
|
||||||
|
)
|
||||||
|
patcher.start()
|
||||||
|
self.addCleanup(patcher.stop)
|
||||||
FakeRegistry.refuse = FakeRegistry.refuse_token = FakeRegistry.no_realm = False
|
FakeRegistry.refuse = FakeRegistry.refuse_token = FakeRegistry.no_realm = False
|
||||||
FakeRegistry.empty_token = FakeRegistry.unknown = False
|
FakeRegistry.empty_token = FakeRegistry.unknown = False
|
||||||
FakeRegistry.not_found = None
|
FakeRegistry.not_found = None
|
||||||
|
|||||||
Reference in new issue
Block a user