Skip to content

ci: every warning is an error, and implicit encodings are warnings - #24

Merged
JsNcAr merged 1 commit into
mainfrom
ci/warnings-are-errors
Oct 15, 2026
Merged

JsNcAr merged 1 commit into
mainfrom
ci/warnings-are-errors

Conversation

@JsNcAr

@JsNcAr JsNcAr commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Follow-up to #23. The suite already passes with every warning turned into an error, with the opt-in encoding warning, and with dependencies included. This makes CI enforce it, so the next deprecation or implicit encoding fails a pull request instead of scrolling past in a summary.

Changes

  • pytest.ini: filterwarnings = error. The comment says what to do when it fires: fix, update the dependency, or record a narrow ignore in Known Issues.
  • .github/workflows/ci.yml and .gitlab-ci.yml: the test command is poetry run python -X warn_default_encoding -m pytest. The flag is on the interpreter rather than in the job environment on purpose: PYTHONWARNDEFAULTENCODING=1 would also reach Poetry's own process, whose dependencies print encoding warnings of their own (seen locally from the regex package).
  • docs/setup.md and AGENTS.md: the rule and the local command that matches CI.
  • Changelog entry (ci: every warning is an error, and implicit encodings are warnings #24).

Python dev mode (-X dev) also passes but is left out: it turns on asyncio debug mode and slows the suite for no additional check this project needs.

Verification, local on Python 3.15.0 with PostgreSQL 17

  • The exact CI command: 140 passed, no warnings.
  • The pure set with --noconftest under the same flag: 24 passed.
  • Sanity: a throwaway test that emits one DeprecationWarning fails under this pytest.ini (FAILED ... DeprecationWarning: x).
  • black and flake8 clean.

🤖 Generated with Claude Code

pytest.ini sets filterwarnings = error: a deprecation in this code or in a
dependency fails the run instead of scrolling past in the summary. Both CI
test jobs start the interpreter with -X warn_default_encoding, so a text read
without an explicit encoding fails too. Set on the interpreter rather than in
the job's env so Poetry's own process stays quiet. The suite was already
clean under both flags with dependencies included (140 passed); a sanity
test with a stray DeprecationWarning fails as intended.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@JsNcAr
JsNcAr merged commit dd490e7 into main Oct 15, 2026
2 checks passed
@JsNcAr
JsNcAr deleted the ci/warnings-are-errors branch October 15, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant