Repository navigation
Run the test matrix nightly and turn warnings into errors - #1382
Merged
Merged
Conversation
CI only ran on push and pull request, so breakage that arrives without a commit -- a dependency release, a tz database update, the calendar rolling over -- stayed invisible until someone happened to push. Master saw CI on 41 distinct days in the last 13 months, twice going more than two months without a run, which is how #1286 reached a downstream packager first. A new Nightly workflow calls the existing Build matrix daily at 04:17 UTC and files one tracking issue per outage, since GitHub's own notification goes to a single person. The schedule lives in its own workflow because GitHub disables a workflow that has a schedule after 60 days without repository activity, and a disabled workflow answers none of its triggers: keeping the cron out of main.yml means an inactivity disable can never take pull request runs down with it. pytest.ini turns warnings into errors. The suite emits none today on 3.10 through 3.14, with and without the calendars and langdetect extras, against both current dependencies and the min pins, so the exemption list starts empty. The exception is the tzlocal 0.2 pin in the min environments, whose invalid string escapes become an import-time SyntaxError under an error filter whenever the installer does not byte-compile, so tox ignores that one message for those two environments. The matrix gains a plain 3.10 leg: 3.10 is a supported interpreter that was only ever tested against the oldest permitted dependency versions, since the Python bump in #1296 consumed the bare 3.10 row. CIFuzz uploads SARIF with github/codeql-action/upload-sarif@v4. v2 has been emitting a failure-level annotation on every run, and v3 emits one of its own, so v4 is what actually clears it. Fixes #1374 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1382 +/- ##
=======================================
Coverage 97.18% 97.18%
=======================================
Files 236 236
Lines 3057 3057
=======================================
Hits 2971 2971
Misses 86 86 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Scope the Nightly token to contents: read at the workflow level, which the called matrix inherits; the report job asks for issues: write itself (CodeQL actions/missing-workflow-permissions). Exempt three environmental warnings from the error filter: tzlocal's two UserWarnings on a host with no or stale time zone configuration, which CI never sees because it always sets TZ but which fail most of the suite for a contributor in a bare container or in nixpkgs' sandbox, and pytest's PytestCacheWarning in a read-only checkout, which turned a green run into exit 1. Drop the DeprecationWarning category from the tzlocal 0.2 escape filter, since CPython 3.12+ emits it as a SyntaxWarning, and carry it through PYTEST_ADDOPTS instead of a copied command line so min and min-all keep following [testenv] commands. Ignore pytest-codspeed's measurement-hook RuntimeWarnings in the benchmark env, so a runner glitch cannot turn CodSpeed red. Upload coverage only on push and pull_request, so a dispatched Nightly does not re-upload master's report. Gate the report job on master and on failure or cancelled, key the tracking issue on a dedicated nightly-failure label so retitling it does not defeat the dedupe, and let a transient listing failure fall through to filing rather than aborting. Lint W605 with ruff: pip's byte-compilation absorbs an invalid-escape warning before pytest can see it, so the linter is the only leg that can. Co-Authored-By: Claude Fable 5.1 <[email protected]>
AdrianAtZyte
approved these changes
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1374.
Daily schedule
A new
Nightlyworkflow runs the existingBuildmatrix at 04:17 UTC every day. It callsmain.ymlthroughworkflow_call, so there is one copy of the matrix, and the legs it runs are the legs pull requests run.The schedule deliberately lives in its own file. GitHub disables a workflow that has a
scheduleafter 60 days without repository activity, and a disabled workflow answers none of its triggers — so aschedule:added tomain.ymlwould put pull request and push CI behind the same inactivity switch. Master has had 67- and 72-day push gaps in the last 14 months, so that is not hypothetical. With the split, an inactivity disable can only ever silence the nightly.Daily rather than weekly, because a fixed-weekday cron lands on the 31st of a month roughly once a year (10–12 times in 11 years, with gaps up to 609 days) — the issue's "4 months out of 12" is optimistic by about 4x. 04:17 is off the top of the hour, which GitHub names as a high-load window, and early enough in the UTC day that the
Pacific/Auckland(UTC+13) andPacific/Fiji(UTC+12) legs stay on the same calendar date as the rest of the matrix — otherwise a month-end failure would reproduce on 9 legs and not on the other 2.A failure reaches a human: the
reportjob files one issue per outage, titledThe nightly build is failing, and stays quiet until it is closed. The tracking issue is identified by a dedicatednightly-failurelabel (created idempotently by the job, alongsideType: Maintenance), so retitling it to record the cause does not defeat the dedupe. The job fires onfailureorcancelled(a leg that hangs until GitHub kills it is a failure too), onmasteronly, so a dispatch on a work branch can neither file a report nor mask the real one — a dispatch on master exercises the whole path. It uses the preinstalledghrather than a third-party action, on the grounds that this repo's demonstrated failure mode is action drift. Rationale for filing an issue rather than relying on GitHub's email: the email goes to whichever single person last edited the cron and depends on their personal notification settings, whereas the CIFuzz deprecation annotation below has been on every run since June and nobody has acted on it.Coverage is uploaded only on
pushandpull_request: a nightly run, scheduled or dispatched, re-tests a commit that already has a report, so a second upload only re-notifies Codecov for the same SHA. The Nightly token is scoped tocontents: readat the workflow level, which the called matrix inherits.Warnings as errors
pytest.inigainsfilterwarnings = error. The suite's own code emits nothing; the three exemptions aftererrorare environmental, not code:UserWarnings on a host with no or stale time zone configuration (Can not find any timezone configuration,Timezone offset does not match system offset). CI never sees them becausemain.ymlalways setsTZ, which takes the code path that skips both — but for a contributor running barepytestin a container without/etc/localtime, or for nixpkgs' sandbox, they fire insideget_localzone()on every call and fail most of the suite (tests/test_date_parser.py: 484 of 540 failed in the review's reproduction).pytest.PytestCacheWarningin a read-only checkout (docker run -v $PWD:/src:ro, a checkout owned by another user): reproduced — a fully green run exits 1 with the plainerrorfilter and exits 0 with the exemption.Measured cost, locally, before committing to it — identical pass counts and exit codes with and without the strict setting, and
-W alwaysshows the suite emits zero warnings:pyallcalendars,langdetect, with--covallpylegmin-alldocssphinx-build -WThree things worth a reviewer's attention:
pytest.inivs CI-only" open. This puts it inpytest.ini, becauseCONTRIBUTING.rstdocuments barepytestas the contributor loop, and a strict setting that only tox sees would mean the documented command does not surface the failure. The blast radius is narrower than the issue assumed:pytest.iniis not in the sdist, so sdist-based packagers (including the openSUSE flow behind Tests fail after 2025-12-31 #1286) inherit nothing; nixpkgs builds from the GitHub tree and does inherit it, and its escape hatch is one line (pytestFlagsArray = [ "-W" "default" ]). If you would rather keep the committed config packager-neutral, the CI-only variant ispytest -W error ...in tox's[testenv] commandsand I am happy to switch it.tzlocal==0.2. The one dependency in the pinned matrix that emits a warning. Its invalid string escapes are a compile-time warning, which an error filter turns into aSyntaxErrorat import — 20 collection errors, 0 tests run. It is invisible on CI only because pip byte-compiles at install time and absorbs the warning; it comes back underpip --no-compile,PYTHONDONTWRITEBYTECODE=1, or a uv-based install. Rather than leave that accidentally green,[testenv:min]setsPYTEST_ADDOPTS = -W "ignore:invalid escape sequence"(inherited bymin-all), so the base command line stays single-sourced in[testenv]. No category on the filter: it is aDeprecationWarningup to 3.11 and aSyntaxWarningfrom 3.12 on. Verified: cold bytecode + the ignore → the suite passes, and an unrelatedDeprecationWarningstill fails the run. The module-scoped form (ignore::DeprecationWarning:tzlocal.unix) does not work here — compile-time warnings are attributed to the importing module.RuntimeWarnings, so a runner glitch cannot turn a red CodSpeed check into a false signal (it was warned-but-green before this PR). And ruff now lintsW605: pip's byte-compilation absorbs an invalid-escape warning in dateparser's own code before pytest can see it, so the linter is the only CI leg that can catch that class. The repo is already clean under it.CONTRIBUTING.rstdocuments the behaviour and what to do when an upstream release turns the suite red:pytest -W defaultto see it, fix it if it is ours, otherwise a narrowignore:aftererror(the last matching filter wins).Python 3.10 leg
One matrix row. 3.10 is advertised in
pyproject.tomlbut has only been tested against the oldest permitted dependency versions since #1296 movedmin/min-allonto it and consumed the bare row.One correction to the issue's rationale: it is not true that "3.10 only ever exercises the pytz-localzone path while 3.11+ exercise
zoneinfo". Nothing in dateparser branches on the interpreter version; the split comes from thetzlocal==0.2pin in[testenv:min]. On 3.10 with current tzlocal,get_localzone()returns azoneinfo.ZoneInfoexactly as it does on 3.11+. So this leg tests 3.10 against current dependencies, and pytz-path coverage stays withmin/min-alleither way.CodeQL action
github/codeql-action/upload-sarif@v2→@v4incifuzz.yml. Not v3, as the deprecation message suggests: v3 emits its owncore.errortelling you to move to v4, so v3 would leave the acceptance criterion unmet. v4 is the current major (v4.37.9, node24) and takes the samesarif_file/checkout_pathinputs, so it is a drop-in.Not in this PR
actions/checkout@v3andactions/setup-python@v5produce a Node-20 deprecation warning annotation on every Build run today (codecov/codecov-action@v5contributes a third through its bundledgithub-script). Same class of drift, but four major bumps with their own behavioural risk; happy to do it as a follow-up, or here if you prefer one sweep.dependabot.yml. Agithub-actionsecosystem entry would have caught the CodeQL v2 drift automatically; it would also open PRs against every stale pin above at once, so it seemed like its own decision.HISTORY.rstis untouched, per the repo's convention that release PRs own it.Verifying after merge
gh workflow run nightly.ymlon master to exercise the scheduled path end-to-end (a dispatch failure files the tracking issue too, so the reporting is testable without waiting for a red night).failure-level annotation.The report job's three branches (nothing open → files; already open → no-op; listing fails → still files, since a duplicate is cheaper than silence) were dry-run against a stubbed
gh. Both workflow files validate against the SchemaStore GitHub-workflow schema, andpre-commit(ruff incl. W605, ruff-format) passes over every tracked file.The second commit addresses a
/code-reviewpass and the CodeQLmissing-workflow-permissionsalert on the first: token scoping, the three environmental exemptions, the tzlocal filter's category and placement, the CodSpeed guard, the codecov trigger set, the report job's gating/dedupe/resilience, and W605.🤖 Generated with Claude Code