Skip to content

Fix CI failure from unclosed warning file in build replay tests#4

Merged
chrizzFTD merged 1 commit into
cursor/directive-body-replay-2e3ffrom
cursor/fix-unclosed-warning-file-9cea
Jun 27, 2026
Merged

Fix CI failure from unclosed warning file in build replay tests#4
chrizzFTD merged 1 commit into
cursor/directive-body-replay-2e3ffrom
cursor/fix-unclosed-warning-file-9cea

Conversation

@chrizzFTD

Copy link
Copy Markdown
Owner

Problem

CI run #7 failed even though all 5 tests passed. The failure came from PYTHONWARNINGS=error in the workflow treating an unclosed file handle as a fatal warning.

The new tests in tests/test_build_replay.py (added in dba7f0f0) construct a Sphinx app with:

warning=open(outdir / "warnings.txt", "w", encoding="utf-8")

That file is never closed. During pytest teardown, Python 3.14 emits a ResourceWarning, which pytest promotes to PytestUnraisableExceptionWarning and causes a non-zero exit code.

Fix

Wrap the Sphinx build in a with open(...) as warning_file: block so the warnings file is closed before pytest finalizes.

Verification

Ran locally with Python 3.14.6 and the same CI flags:

PYTHONWARNINGS=error pytest --cov --durations=10 .

All 5 tests pass with exit code 0.

Open in Web Open in Cursor 

The new Sphinx integration tests passed assertions but left the
warnings.txt file handle open. With PYTHONWARNINGS=error in CI, pytest
reports that as a ResourceWarning and exits with code 1.

Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
@chrizzFTD
chrizzFTD merged commit 40641aa into cursor/directive-body-replay-2e3f Jun 27, 2026
2 checks passed
@chrizzFTD
chrizzFTD deleted the cursor/fix-unclosed-warning-file-9cea branch June 27, 2026 06:14
chrizzFTD added a commit that referenced this pull request Jun 27, 2026
Update vendored JS to chrizzFTD/pyrepl-web@5299fa9 on branch
cursor/repl-startup-replay-2e3f. Picks up async Pygments restore and
replay-src fetch error surfacing from pyrepl-web PR #4.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Jun 30, 2026
Vendor cursor/resolve-package-urls-0bbd@1d95c619, which is rebased onto
grill with replay mode (#4) and relative wheel URL resolution. Restores
replay-src runtime support that was lost in the earlier pre-rebase vendor.

Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
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.

2 participants