Skip to content

tests: cover both directions of the NO_EXTENSIONS import branch#782

Merged
bdraco merged 3 commits into
aio-libs:masterfrom
bdraco:cover-no-extensions-import-branch
May 20, 2026
Merged

tests: cover both directions of the NO_EXTENSIONS import branch#782
bdraco merged 3 commits into
aio-libs:masterfrom
bdraco:cover-no-extensions-import-branch

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented May 19, 2026

What do these changes do?

Add two tests that re-import the package under monkeypatch
with FROZENLIST_NO_EXTENSIONS both set and unset, so every
Codecov upload exercises both directions of the import-time
if not NO_EXTENSIONS: branch in frozenlist/__init__.py.

Until now each CI matrix job only ran one direction of that
branch (depending on its FROZENLIST_NO_EXTENSIONS value),
so every upload reported the line as a one-sided partial.
Codecov does not merge the two opposite partials across
uploads, which left the codecov/project/lib gate stuck at
98.38% (target 100%) on every PR; see #780 for one example.

Are there changes in behavior for the user?

No.

Related issue number

No linked issue; closes the persistent failure of
codecov/project/lib on recent PRs (#780, #779, #777, #774,
and others).

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes — N/A, no user-facing change
  • If you provide code modifications, please add yourself to CONTRIBUTORS.txt
  • Add a new news fragment into the CHANGES folder
Agent run details (optional, for reviewers)

Local verification, both legs at 100% coverage on frozenlist/__init__.py:

$ COVERAGE_CORE=ctrace python -m pytest tests/test_frozenlist.py \
    --cov=frozenlist --cov-branch --cov-report=term-missing -q
frozenlist/__init__.py        62      0     14      0   100%
112 passed in 0.18s

$ FROZENLIST_NO_EXTENSIONS=1 COVERAGE_CORE=ctrace python -m pytest \
    tests/test_frozenlist.py --cov=frozenlist --cov-branch \
    --cov-report=term-missing -q
frozenlist/__init__.py        62      0     14      0   100%
112 passed in 0.16s

Drafted with Claude Code (Opus 4.7); reviewed by @bdraco.

The ``if not NO_EXTENSIONS:`` block in ``frozenlist/__init__.py``
only runs in one direction per process, depending on the value
of ``FROZENLIST_NO_EXTENSIONS`` at import time. Each Codecov
upload from the CI matrix therefore reports that line as a
one-sided partial, and Codecov does not merge the two opposite
partials across uploads, so the ``codecov/project/lib`` gate
stays stuck at 98.38%.

Add two tests that re-import the module under ``monkeypatch``
with the env var both set and unset. Every Codecov upload now
hits both branch directions and the gate can reach 100%.
The Sphinx docs build (and ``make spelling``) fails the
intersphinx lookup for ``:mod:`frozenlist``` because the project
does not document the package itself as a Python domain target.
Match the convention used by the other fragments and refer to
the module name in plain double-backticks.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3a1a76f) to head (6824f97).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #782   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          370       383   +13     
  Branches         9         9           
=========================================
+ Hits           370       383   +13     
Flag Coverage Δ
CI-GHA 100.00% <100.00%> (+0.27%) ⬆️
OS-Linux 100.00% <100.00%> (+0.27%) ⬆️
OS-Windows 100.00% <100.00%> (+0.27%) ⬆️
OS-macOS 100.00% <100.00%> (+0.27%) ⬆️
Py-3.10.11 100.00% <100.00%> (+0.27%) ⬆️
Py-3.10.20 100.00% <100.00%> (+0.27%) ⬆️
Py-3.11.15 100.00% <100.00%> (+0.27%) ⬆️
Py-3.11.9 100.00% <100.00%> (+0.27%) ⬆️
Py-3.12.10 100.00% <100.00%> (+0.27%) ⬆️
Py-3.12.13 100.00% <100.00%> (+0.27%) ⬆️
Py-3.13.13 100.00% <100.00%> (+0.27%) ⬆️
Py-3.14.4 100.00% <100.00%> (+0.27%) ⬆️
Py-3.14.5 100.00% <100.00%> (+0.27%) ⬆️
Py-3.14.5t 100.00% <100.00%> (+0.27%) ⬆️
Py-pypy3.10.16-7.3.19 99.73% <100.00%> (+0.81%) ⬆️
VM-macos-latest 100.00% <100.00%> (+0.27%) ⬆️
VM-ubuntu-latest 100.00% <100.00%> (+0.27%) ⬆️
VM-windows-11-arm 100.00% <100.00%> (+0.27%) ⬆️
VM-windows-latest 100.00% <100.00%> (+0.27%) ⬆️
pytest 100.00% <100.00%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread CHANGES/782.contrib.rst Outdated
Co-authored-by: J. Nick Koston <nick+github@koston.org>
@bdraco bdraco marked this pull request as ready for review May 20, 2026 00:21
@bdraco bdraco merged commit e3cf3f5 into aio-libs:master May 20, 2026
54 checks passed
@bdraco bdraco deleted the cover-no-extensions-import-branch branch May 20, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant