Skip to content

Commit 900328f

Browse files
committed
test: centralize integration test base URL
1 parent 57f0068 commit 900328f

13 files changed

Lines changed: 1152 additions & 1074 deletions

tests/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""Test package.
2+
3+
This file exists so test modules can share small helpers/constants via imports.
4+
"""

tests/_constants.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Shared test constants.
2+
3+
Centralizes the default test server base URL so integration tests don't drift.
4+
5+
Notes:
6+
- This URL must never point at the production port (39765).
7+
- Tests may still override via AGENTCHATBUS_TEST_BASE_URL when running against
8+
an externally managed server, but the default remains the dedicated test port.
9+
"""
10+
11+
from __future__ import annotations
12+
13+
import os
14+
15+
DEFAULT_TEST_PORT = 39769
16+
DEFAULT_TEST_BASE_URL = "http://127.0.0.1:39769"
17+
18+
if not DEFAULT_TEST_BASE_URL.endswith(f":{DEFAULT_TEST_PORT}"):
19+
raise RuntimeError("DEFAULT_TEST_BASE_URL must match DEFAULT_TEST_PORT.")
20+
21+
if DEFAULT_TEST_PORT == 39765:
22+
raise RuntimeError("DEFAULT_TEST_PORT must never be the production port 39765.")
23+
24+
TEST_BASE_URL_ENV = "AGENTCHATBUS_TEST_BASE_URL"
25+
TEST_BASE_URL = os.getenv(TEST_BASE_URL_ENV, DEFAULT_TEST_BASE_URL)

0 commit comments

Comments
 (0)