Skip to content

Commit 826d90f

Browse files
committed
Pin spec server path, not full URL, in base-URL drift test
Previously test_default_base_url_matches_spec_servers compared the full URL of openapi.json's first server entry against DEFAULT_BASE_URL, which forced the spec to come from the production host. Regenerating the client from staging (different host, same /v0.4 path) tripped the test even though the API-version contract was identical. The version path is the actual safety property the test cares about; the host is just the environment, and the runtime base URL is overridable on IonQClient anyway. Compare urlparse(...).path on both sides so staging regenerations pass while a /v0.4 -> /v0.5 bump still fails until DEFAULT_BASE_URL is updated.
1 parent 242f706 commit 826d90f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/test_docs_consistency.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ def test_spec_path_matches_default_base_url():
139139

140140

141141
def test_default_base_url_matches_spec_servers():
142+
# Compare paths, not full URLs, so a staging-fetched spec
143+
# (different host, same /vX.Y path) still satisfies the version pin.
142144
spec = json.loads((ROOT / "openapi.json").read_text())
143-
assert spec["servers"][0]["url"] == DEFAULT_BASE_URL
145+
assert urlparse(spec["servers"][0]["url"]).path == urlparse(DEFAULT_BASE_URL).path
144146

145147

146148
def test_single_spdx_year_across_package():

0 commit comments

Comments
 (0)