Skip to content

tests: start every server test on a free port - #36

Merged
tae898 merged 1 commit into
mainfrom
port/fix-466
Oct 24, 2026
Merged

tae898 merged 1 commit into
mainfrom
port/fix-466

Conversation

@tae898

@tae898 tae898 commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Port of humemai/arcadedb-embedded-python#466 (merged there). Based on main.

The server's default HTTP port is the fixed 2480, so any test that starts a server without choosing a port fails with "Unable to listen to a HTTP port in the configured port range 2480 - 2480" whenever anything else on the machine holds 2480. Every test that starts a server on the default or a fixed port now passes config={"http_port": free_port()}, with one free_port() helper in tests/conftest.py (the wire-protocol tests keep their own _free_ports, which hands out several distinct ports at once; this also follows the "never address a hand-picked port" rule in CLAUDE.md). Touches test_server_patterns.py (all six servers), test_server.py (the fixed 2480 and 8080 become free ports and the asserts compare against the chosen port), test_server_packaging.py and test_server_http_endpoints.py.

Differences from the original: test_server_context_manager in test_server.py also started a server on the default port and was missed there, so it is fixed here. The original's served fixture in test_server_packaging.py does not exist on main yet.

Checked locally with a dummy listener holding 0.0.0.0:2480, on the released 26.10.2 linux x86_64 cp312 wheel (the tests do not depend on the unreleased engine), pinned taskset -c 0-3, JVM -Xmx2g: test_server.py, test_server_patterns.py, test_server_http_endpoints.py and test_server_packaging.py::test_server_starts_and_serves_http: 17 passed. The same run on unfixed main (without test_server_patterns.py): 4 failed, 4 errors. pre-commit (black, isort) passes. The wire-protocol tests were not touched and not run.

Possible conflicts: #28 edits tests/test_server_packaging.py below test_server_starts_and_serves_http (adds a served fixture that starts a server on the default port, so it needs config={"http_port": free_port()} once both are in), and #20 edits the top of the same file; #29 edits tests/conftest.py near the top (imports), not near TEST_PASSWORD. I expect textual merges to be clean except possibly the import line in test_server_packaging.py.

🤖 Generated with Claude Code

Every test that starts a server on the default or a fixed port now passes config={"http_port": free_port()}, with one free_port() helper in tests/conftest.py (the wire-protocol tests keep their own _free_ports, which hands out several distinct ports at once). Touches test_server_patterns.py (all six servers), test_server.py (the fixed 2480 and 8080 become free ports, the asserts compare against the chosen port, and test_server_context_manager gets one too), test_server_packaging.py and test_server_http_endpoints.py.

Port of humemai/arcadedb-embedded-python#466.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tae898
tae898 merged commit b6aaf85 into main Oct 24, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant