You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cover diagnostic warning retention and reset behavior with tests #94
The warning log in src/pythonnative/diagnostics.py retains the most recent 200 messages, returns a snapshot in oldest-first order, and clears both messages and deduplication keys when clear_warnings() is called.
tests/test_core_semantics.py already tests deduplication for an explicit key and some production-mode behavior, but it doesn't directly cover log eviction, snapshot isolation, or resetting deduplication. These guarantees keep diagnostics useful during long preview sessions and prevent tests from leaking warning state.
Requested change
Extend the existing diagnostics-primitives section of tests/test_core_semantics.py, using its dev_mode fixture and pytest capture helpers. No runtime changes are expected.
Acceptance criteria
Record 201 distinct warnings and assert that exactly the newest 200 remain in oldest-first order.
Mutating the list returned by get_warnings() doesn't change the internal log.
clear_warnings() empties the log and allows a previously used warn_once key to emit again.
Repeated warn_once() calls without a key deduplicate by message; different messages remain distinct.
In production mode, calling warn_once() doesn't consume its key: after enabling dev mode, the same key can still emit.
Tests restore diagnostic state and use no sleeps, threads, or native backends.
Verification
uv run pytest tests/test_core_semantics.py -q
./scripts/check.sh
test(diagnostics): cover warning retention and reset behavior
Before starting
Please follow the issue-claiming process: check for an assignee or linked pull request, comment to claim the issue, and wait for a maintainer to assign it before opening a pull request. Contributor setup is in CONTRIBUTING.md.
Hi, I'd like to take this one. I've contributed a few PRs here before (#49, #48, #68, #81). I'll add tests for how diagnostic warnings are kept and reset, and open a PR within a few days.
Activity
glenlouis8 commentedon Oct 9, 2026
Hi, I'd like to take this one. I've contributed a few PRs here before (#49, #48, #68, #81). I'll add tests for how diagnostic warnings are kept and reset, and open a PR within a few days.