Skip to content

Self-hosted AI workspace.

Python

Merge current lab into agent runtime decomposition

Alexandre Teixeira3748a621d163
diff --cc tests/conftest.py
index d4eb0a930,5fcf02113..3a8e7f4e4
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@@ -137,7 -134,20 +134,22 @@@ def _serve_test_static()
class _Server(socketserver.TCPServer):
allow_reuse_address = True
- server = _Server(("127.0.0.1", port), _Handler)
+ requested = int(os.environ.get("ODYSSEUS_TEST_STATIC_PORT") or 0)
++ if not 0 <= requested <= 65535:
++ raise ValueError("ODYSSEUS_TEST_STATIC_PORT must be between 0 and 65535")
+ try:
+ server = _Server(("127.0.0.1", requested), _Handler)
+ except OSError as exc:
+ # Port 0 cannot collide, so this only fires for an explicit pin.
+ raise RuntimeError(
+ f"ODYSSEUS_TEST_STATIC_PORT={requested} is not bindable; unset it to "
+ "let the browser tests pick an ephemeral port"
+ ) from exc
+
+ origin = f"http://127.0.0.1:{server.server_address[1]}"
+ previous_origin = os.environ.get("ODYSSEUS_TEST_STATIC_ORIGIN")
+ os.environ["ODYSSEUS_TEST_STATIC_ORIGIN"] = origin
+
thread = threading.Thread(target=server.serve_forever, daemon=True)
thread.start()
try: