LITE-33583: Runtime floor to Python 3.10 and modernize http toolchain#86
Merged
Conversation
b52dfd0 to
27c6c0b
Compare
820ce32 to
c0afad9
Compare
…cker
Raise the runtime floor to Python 3.10 (verified on 3.10 and 3.12) and
modernize the HTTP toolchain:
- python >=3.10,<4 (drop 3.9 from deps and CI matrix)
- httpx >=0.28, pytest-httpx >=0.35, inflect >=7
- dev: pytest >=8,<9, pytest-asyncio >=0.24,<2, pytest-cov <7
pytest-httpx >=0.35 (which pulls httpx 0.28) is the only path to httpx
0.28, and it forces the pytest/pytest-asyncio bumps transitively. Its
0.31+ API changes break the async mocker, so adapt it:
- HTTPXMock now requires _HTTPXMockOptions; construct it with
can_send_already_matched_responses=True so a single registered
response answers the ConnectClient's retried requests. The strict
assert_all_requests_were_expected default is kept, so an unmocked
request fails the test.
- reset() no longer performs assertions; call _assert_options()
explicitly, gated by success, to keep failing on unrequested mocks.
- match_content now serializes JSON with compact separators to match
httpx 0.28's compact request-body serialization.
Mark test_execute_error_with_reason (native httpx_mock fixture, retries
on 500) with the matching httpx_mock options. All tests pass.
dd2d0c6 to
925d1d0
Compare
connect/client/fluent.py imported `Proxy` from httpx._config and `get_environment_proxies` from httpx._utils. Both are private httpx APIs that can change or vanish on any minor release, and the import happens at module load, so a break would take down the whole client, not just proxy support. Reimplement the environment proxy discovery locally as _get_environment_proxies() on top of stdlib urllib.request.getproxies() and ipaddress, faithfully porting httpx 0.28's algorithm: http/https/all schemes (normalizing bare host:port to a http:// URL) and NO_PROXY handling for domains, IPv4, IPv6, localhost, explicit-scheme hosts, and the NO_PROXY=* global bypass. Use the public httpx.Proxy instead of the private one. Add tests for this previously untested logic (scheme normalization, each NO_PROXY host form, and the wildcard bypass). All 407 tests pass.
925d1d0 to
22e568f
Compare
The install section still stated Python 3.9 as the minimum. Python 3.9 support was dropped on this branch (pyproject.toml now requires >=3.10), so align the README with the actual requirement.
This was referenced Jul 1, 2026
qarlosh
requested changes
Jul 1, 2026
qarlosh
left a comment
There was a problem hiding this comment.
Requesting changes. Details in the inline comments.
Address PR review on the httpx 0.28 / pytest-httpx 0.35 bump. - match_content now mirrors httpx 0.28's request-body serialization exactly by adding ensure_ascii=False and allow_nan=False. Without them a non-ASCII match_body serialized to \uXXXX escapes while httpx sends raw UTF-8, so the mock silently failed to match. - Pin an upper bound pytest-httpx >=0.35,<1. It is a runtime dependency (connect.client.testing ships the mocker and a pytest11 plugin) that relies on private pytest_httpx API (_HTTPXMockOptions, _assert_options), so an unbounded minor bump could break downstream test suites. - Add test_create_match_non_ascii_body and test_unrequested_mock_fails to cover the non-ASCII matching and the reset() assertion path, which previously had no coverage.
|
qarlosh
approved these changes
Jul 2, 2026
pcaro
added a commit
to cloudblue/connect-cli
that referenced
this pull request
Jul 2, 2026
connect-openapi-client 35.0 dropped its importlib-metadata<7 pin (cloudblue/connect-python-openapi-client#86), which was the only thing blocking interrogatio 2.4 (which needs importlib-metadata>=8.5). connect-openapi-client >=29 -> >=35 (34.0 -> 35.0) interrogatio ^2.3.1 -> ^2.4 (2.3.1 -> 2.4.0) importlib-metadata 6.x -> 8.9.0 httpx -> 0.28.1 (pulled by client 35) pytest-httpx 0.29.0 -> 0.35.0 (idem) sniffio removed (no longer required) Full suite: 715 passed.
pcaro
added a commit
to cloudblue/connect-cli
that referenced
this pull request
Jul 2, 2026
Clean, targeted dependency refresh on top of current master, replacing the stale bot PR #248. Mirrors the sibling bump in cloudblue/connect-python-openapi-client#86. Test toolchain: pytest 7.2.2 -> 8.4.2 pytest-cov 2.12.1 -> 6.3.0 coverage 5.5 -> 7.14.3 responses 0.20.0 -> 0.26.1 pytest 8 changed collection ordering, exposing a latent isolation bug: tests/plugins/play/test_play_commands.py deletes and reimports connect.cli.ccli, so test_ccli.py's module-level 'from ... import main' bound to a stale module object that mocker.patch never touched. Fixed by importing main inside each test. Lint toolchain: flake8 5.0.4 -> 7.3.0 flake8-bugbear 22.12.6 -> 25.11.29 flake8-commas 2.1.0 -> 4.0.0 flake8-isort 5.0.3 -> 6.1.2 flake8-broken-line 0.5.0 -> 1.0.0 Only bugbear codes are enforced (select = "B"); bugbear 25 adds B017, which flagged a broad pytest.raises(Exception) in test_http.py masking the real ValueError; narrowed it. Runtime deps: connect-openapi-client >=29 -> >=35 (34.0 -> 35.0) interrogatio 2.3.1 -> 2.4.0 iso3166 1.0.1 -> 2.1.1 phonenumbers 8.13.55 -> 9.0.33 poetry-core 1.9.1 -> 2.4.1 click 8.3.1 -> 8.4.2 requests 2.32.5 -> 2.34.2 openapi-client 35.0 dropped its importlib-metadata<7 pin (#86), which unblocked interrogatio 2.4 (needs importlib-metadata>=8.5); that also pulls httpx 0.28.1 / pytest-httpx 0.35.0 and drops sniffio. Lint/format stack (black) and runtime majors gated upstream (eaas-core, reports-core, rich via markdown-renderer) are left untouched. Full suite: 715 passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Raise the runtime floor to Python 3.10 (verified on 3.10 and 3.12) and modernize the HTTP toolchain.
python >=3.10,<4(drop 3.9 from deps + CI matrix)httpx >=0.28,pytest-httpx >=0.35,inflect >=7pytest >=8,<9,pytest-asyncio >=0.24,<2,pytest-cov <7poetry.lockre-resolved → httpx 0.28.1, pytest-httpx 0.35.0, pytest 8.4.2, pytest-asyncio 1.4.0Why this is one change
We like to keep "updated" (now we support even 3.10 ) connect-cli and this dependency had pinned oudated versions.
API changes absorbed (pytest-httpx 0.31+ / httpx 0.28)
Adapted
connect/client/testing/fluent.py:HTTPXMock()now requires_HTTPXMockOptions. Constructed withassert_all_requests_were_expected=False+can_send_already_matched_responses=Trueto preserve the previous mocker semantics (one registered response answers retried requests — the client retries on 5xx).reset()no longer asserts; call_assert_options()explicitly, gated bysuccess, to keep failing on unrequested mocks.match_contentnow serializes JSON with compact separators to match httpx 0.28's compact request-body serialization.test_execute_error_with_reason(nativehttpx_mockfixture, retries on 500) marked with matching@pytest.mark.httpx_mock(...)options.Verification
All 399 tests pass on Python 3.10 and 3.12. flake8 clean on changed files.