Jump to solution
Verify

The Fix

Fixes the test_add_static_path_resolution failure on macOS by resolving the home directory strictly.

Based on closed aio-libs/aiohttp issue #10436 · PR/commit linked

Production note: Watch p95/p99 latency and retry volume; timeouts can turn into retry storms and duplicate side-effects.

Jump to Verify Open PR/Commit
@@ -373,7 +373,7 @@ def test_add_static_path_resolution(router: web.UrlDispatcher) -> None: res = router.add_static("/", "~/..") directory = str(res.get_info()["directory"]) - assert directory == str(pathlib.Path.home().parent) + assert directory == str(pathlib.Path.home().resolve(strict=True).parent)
repro.py
/sw/bin/python3.8 -m pytest -vv || exit 2 /sw/lib/python3.8/site-packages/pytest_benchmark/logger.py:46: PytestBenchmarkWarning: Benchmarks are automatically disabled because xdist plugin is active.Benchmarks cannot be performed reliably in a parallelized environment. warner(PytestBenchmarkWarning(text)) ==================================================================================================== test session starts ===================================================================================================== platform darwin -- Python 3.8.13, pytest-7.4.4, pluggy-1.4.0 -- /sw/bin/python3.8 codspeed: 2.2.1 (callgraph: not supported) cachedir: .pytest_cache hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/sw/build.build/aiohttp-py38-3.10.11-1/aiohttp-3.10.11/.hypothesis/examples') benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000) Using --randomly-seed=726549581 rootdir: /sw/build.build/aiohttp-py38-3.10.11-1/aiohttp-3.10.11 configfile: setup.cfg testpaths: tests/ plugins: cov-6.0.0, codspeed-2.2.1, hypothesis-6.42.1, flaky-3.8.1, timeout-2.3.1, benchmark-3.4.1, randomly-3.15.0, asyncio-0.21.1, datadir-1.5.0, pyfakefs-5.3.4, xdist-3.5.0, mock-3.12.0 asyncio: mode=strict 4 workers [3068 items] error / 1 skipped scheduling tests via LoadScheduling
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Apply the official fix\nFixes the test_add_static_path_resolution failure on macOS by resolving the home directory strictly.\nWhen NOT to use: This fix should not be used if the directory resolution behavior is expected to remain unchanged.\n\n

Why This Fix Works in Production

  • Trigger: E AssertionError: assert '/private/tmp' == '/tmp'
  • Mechanism: The test fails due to a discrepancy between the resolved home directory and the expected path on macOS
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • Shows up under Python 3.8.13 in real deployments (not just unit tests).
  • The test fails due to a discrepancy between the resolved home directory and the expected path on macOS
  • Surfaces as: ______________________________________________________________________________________________ test_add_static_path_resolution…

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Is it fine if you add .resolve(strict=True)?”
@Dreamsorcerer · 2025-02-09 · source

Failure Signature (Search String)

  • E AssertionError: assert '/private/tmp' == '/tmp'

Error Message

Stack trace
error.txt
Error Message ------------- ______________________________________________________________________________________________ test_add_static_path_resolution _______________________________________________________________________________________________ [gw0] darwin -- Python 3.8.13 /sw/bin/python3.8 router = <aiohttp.web_urldispatcher.UrlDispatcher object at 0x109647880> def test_add_static_path_resolution(router: any) -> None: """Test that static paths are expanded and absolute.""" res = router.add_static("/", "~/..") directory = str(res.get_info()["directory"]) assert directory == str(pathlib.Path.home().parent) E AssertionError: assert '/private/tmp' == '/tmp' E - /tmp E + /private/tmp directory = '/private/tmp' res = <StaticResource -> PosixPath('/private/tmp')> router = <aiohttp.web_urldispatcher.UrlDispatcher object at 0x109647880> tests/test_urldispatch.py:354: AssertionError

Minimal Reproduction

repro.py
/sw/bin/python3.8 -m pytest -vv || exit 2 /sw/lib/python3.8/site-packages/pytest_benchmark/logger.py:46: PytestBenchmarkWarning: Benchmarks are automatically disabled because xdist plugin is active.Benchmarks cannot be performed reliably in a parallelized environment. warner(PytestBenchmarkWarning(text)) ==================================================================================================== test session starts ===================================================================================================== platform darwin -- Python 3.8.13, pytest-7.4.4, pluggy-1.4.0 -- /sw/bin/python3.8 codspeed: 2.2.1 (callgraph: not supported) cachedir: .pytest_cache hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/sw/build.build/aiohttp-py38-3.10.11-1/aiohttp-3.10.11/.hypothesis/examples') benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000) Using --randomly-seed=726549581 rootdir: /sw/build.build/aiohttp-py38-3.10.11-1/aiohttp-3.10.11 configfile: setup.cfg testpaths: tests/ plugins: cov-6.0.0, codspeed-2.2.1, hypothesis-6.42.1, flaky-3.8.1, timeout-2.3.1, benchmark-3.4.1, randomly-3.15.0, asyncio-0.21.1, datadir-1.5.0, pyfakefs-5.3.4, xdist-3.5.0, mock-3.12.0 asyncio: mode=strict 4 workers [3068 items] error / 1 skipped scheduling tests via LoadScheduling

Environment

  • Python: 3.8.13

What Broke

The test for static path resolution fails, leading to incorrect behavior in path handling.

Why It Broke

The test fails due to a discrepancy between the resolved home directory and the expected path on macOS

Fix Options (Details)

Option A — Apply the official fix

Fixes the test_add_static_path_resolution failure on macOS by resolving the home directory strictly.

When NOT to use: This fix should not be used if the directory resolution behavior is expected to remain unchanged.

Fix reference: https://github.com/aio-libs/aiohttp/pull/10447

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be used if the directory resolution behavior is expected to remain unchanged.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Make timeouts explicit and test them (unit + integration) to avoid silent behavior changes.
  • Instrument retries (attempt count + reason) and alert on spikes to catch dependency slowdowns.

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.