Skip to content

Commit fd09780

Browse files
committed
fix(vcr): allow loopback hosts in vcr_config to support Windows asyncio self-pipe
1 parent e1d4cc9 commit fd09780

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎tests/conftest.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ def vcr_config() -> dict[str, Any]:
120120
VCR configuration passed to `VCR.use_cassettes`.
121121
"""
122122
return {
123+
# --block-network (see addopts) blocks every socket connect, which on Windows
124+
# takes the suite down before a single test runs: there the ProactorEventLoop
125+
# builds its self-pipe with socket.socketpair(), whose Windows fallback
126+
# connects to 127.0.0.1, so asyncio.run() itself raises "Network is disabled".
127+
# Loopback is the only host let back through; provider endpoints stay blocked.
128+
"allowed_hosts": ["127.0.0.1", "localhost"],
123129
# The registered JSON serializer keeps HTTP bodies as nested objects, so the
124130
# cassette diffs like its payloads instead of escaped string literals.
125131
"serializer": "json",

0 commit comments

Comments
 (0)