Skip to content

Isolate tests from external GraphServers - #263

Open
KonradPilch wants to merge 3 commits into
devfrom
tests/do-not-attach-to-existing-server
Open

Isolate tests from external GraphServers#263
KonradPilch wants to merge 3 commits into
devfrom
tests/do-not-attach-to-existing-server

Conversation

@KonradPilch

@KonradPilch KonradPilch commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

Fix for issue #261 : Test suite silently attaches to any GraphServer already on the default port

Implementing this surfaced issue #264 : Python 3.14 forkserver workers can use a stale GraphServer address.
Fix for this new issue included in the last commit.

Solution for #261

  • Run every test against a fresh GraphServer on an OS-assigned loopback port.
  • Prevent tests from attaching to unrelated GraphServers already running on the default port.
  • Preserve coverage for implicit GraphServer startup.
  • Re-enable and harden test_attach with timeouts, exit-code checks, and process cleanup.

Minor note

While hardening test_attach, its new exit-code checks exposed a Windows spawn issue: child processes could not import the test module under pytest’s importlib mode. The second commit also fixes that import path issue.

Solution for #264

Resolves the effective GraphServer address in the parent and passes it explicitly to backend processes. This removes the dependency on fork-server environment inheritance and includes regression coverage.

Testing

  • Windows / python 3.11: 386 passed, 41 skipped
  • Linux / python 3.14: 392 passed, 39 skipped
  • Previously hanging test_attach -> test_shm_grow sequence: 4 passed
  • Ruff lint and formatting checks passed

Start a fresh GraphServer on an OS-assigned loopback port for every test, then point in-process defaults and child environments at it. This prevents tests from attaching to unrelated servers while preserving explicit address overrides. Keep implicit auto-start coverage with a dedicated isolated test and re-enable test_attach for multiprocess attachment.
Wait for both child processes with a bounded timeout and assert successful exit codes. Ensure failed or hung children are terminated and make the test module importable to Windows spawn workers.
Pass the resolved GraphServer address to backend processes so Python 3.14 forkserver workers do not reuse a stale environment value.
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