Skip to content

fix: resolve allowed hostnames with the real getaddrinfo - #552

Merged
miketheman merged 1 commit into
mainfrom
resolve-true-getaddrinfo
Oct 12, 2026
Merged

miketheman merged 1 commit into
mainfrom
resolve-true-getaddrinfo

Conversation

@miketheman

Copy link
Copy Markdown
Owner

Since #482 added DNS blocking, resolve_hostnames called the patched socket.getaddrinfo. With the README's conftest recipe (disable_socket() in pytest_runtest_setup) plus a hostname in --allow-hosts, every test errored in setup with SocketBlockedError, and the resolution cache never filled.

Call the saved _true_getaddrinfo instead. The test fixture that fakes DNS now patches that name, and a new test covers the conftest recipe with --allow-hosts=localhost.

Since DNS blocking landed in #482, resolve_hostnames called the patched
socket.getaddrinfo. With the README's conftest recipe (disable_socket()
in pytest_runtest_setup, which runs before the plugin's hook) and a
hostname in --allow-hosts, every test errored in setup with
SocketBlockedError, and the resolution cache never filled.

Call the saved _true_getaddrinfo instead, and point the test fixture
that fakes DNS at it.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman miketheman added the bug Something isn't working label Oct 12, 2026
@codspeed

codspeed Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 50.37%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 11 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_bench_host_from_address 24.6 µs 16.3 µs +50.37%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing resolve-true-getaddrinfo (5fd5d52) with main (d8db169)

Open in CodSpeed

@miketheman
miketheman merged commit 7e1dac0 into main Oct 12, 2026
35 checks passed
@miketheman
miketheman deleted the resolve-true-getaddrinfo branch October 12, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant