Skip to content

Conversation

@cdecker
Copy link
Member

@cdecker cdecker commented Jan 14, 2026

This PR fixes issues with the logging library raising exceptions when pytest swaps out sys.stdout/sys.stderr for output capture.

Changes

  1. Added TEST_LOG_IGNORE_ERRORS environment variable to disable logging.raiseExceptions in the test setup fixture
  2. Set TEST_LOG_IGNORE_ERRORS=1 in:
    • GitHub Actions CI workflow (.github/workflows/ci.yaml)
    • Coverage nightly workflow (.github/workflows/coverage-nightly.yaml)
    • Makefile test target
    • Taskfile.yml

Problem

The logging library was raising exceptions when pytest captured output by temporarily replacing sys.stdout/sys.stderr. This caused test failures due to logging handlers attempting to write to closed file descriptors.

Solution

When TEST_LOG_IGNORE_ERRORS=1 is set, the test fixture now disables logging.raiseExceptions, allowing tests to continue even if logging encounters errors during pytest's output capture.

@cdecker cdecker force-pushed the 202601-logging-denoise branch from f832c6d to 9f468a2 Compare January 14, 2026 17:48
@rustyrussell
Copy link
Contributor

rustyrussell commented Jan 19, 2026

Uh. What problem are you seeing? This is an awful lot of weird LLM code that nobody understands to fix a problem I haven't seen described...

Edit: Ah, those files look like accidental adds! No wonder I was confused!!

@cdecker
Copy link
Member Author

cdecker commented Jan 19, 2026

YEah, I need to clean this one up, since I was also testing if we can trace the test execution closer, learning where we lose time, but those scripts and shims are definitely premature in this PR.

@cdecker cdecker force-pushed the 202601-logging-denoise branch from 9f468a2 to d994cf8 Compare January 19, 2026 11:31
…ure is disabled.

Changelog-Fixed: Testing infrastructure no longer fails when logging output capture is disabled.
@cdecker cdecker force-pushed the 202601-logging-denoise branch from d994cf8 to 09f72eb Compare January 19, 2026 12:23
@cdecker
Copy link
Member Author

cdecker commented Jan 19, 2026

And just to add the missing context here: this is an attempt to prevent the flood of "operation on a closed file" tracebacks that have a tendency of polluting logs. The root cause is that the subprocesses continue emitting logs, but the logging sync has been closed by the output capturing sub-system in pytest, thus hiding the actual log lines, in a flood of tracebacks.

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.

3 participants