From 705c6c52728101608792c698a9a242c88f2a4945 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 16 Aug 2026 18:47:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Fix=20the=20circular=20import=20?= =?UTF-8?q?branch=20directory=20skip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #13388 introduced partial branch coverage in a directory scan skip logic in `tests/test_circular_imports.py::test_no_warnings`. This patch is attempting to address is by bringing the coverage on the test module back to 100% metric via an explicitly applied "no branch" pragma. The missing branch coverage only appears in test environments checking real project installs that are non-editable. Editable installs have a `aiohttp/.hash/` cache directory that would contain files like `_http_parser.pyx.hash`, `_cparser.pxd.hash`, `hdrs.py.hash`, `_find_header.pxd.hash` and `_http_writer.pyx.hash` which speed up processes in local development environment. The `continue` instruction would only be hit there. --- tests/test_circular_imports.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_circular_imports.py b/tests/test_circular_imports.py index 227da10e53b..bb780fa84e6 100644 --- a/tests/test_circular_imports.py +++ b/tests/test_circular_imports.py @@ -71,8 +71,13 @@ def _discover_path_importables( if pkg_dir_path.parts[-1] == "__pycache__": continue - if all(Path(_).suffix != ".py" for _ in file_names): - continue + if all(Path(_).suffix != ".py" for _ in file_names): # pragma: no branch + # NOTE: This is only possible when testing editable installs where + # NOTE: the directory lookup encounters the `aiohttp/.hash/` cache + # NOTE: directory with files like `_http_parser.pyx.hash` in it that + # NOTE: never get included into source distributions or wheels and so + # NOTE: the module discovery mechanism never hits this code branch. + continue # pragma: no cover rel_pt = pkg_dir_path.relative_to(pkg_pth) pkg_pref = ".".join((pkg_name,) + rel_pt.parts)