Skip to content

Fix faulthandler for Twisted Logger when used with "--capture=no" - #8250

Merged
nicoddemus merged 1 commit into
pytest-dev:masterfrom
daq-tools:fix-twisted-capture
Jan 20, 2021
Merged

nicoddemus merged 1 commit into
pytest-dev:masterfrom
daq-tools:fix-twisted-capture

Conversation

@amotl

@amotl amotl commented Jan 17, 2021 •

Copy link
Copy Markdown
Contributor

Hi again,

this patch resolves #8249.

The background on this is that the Twisted Logger will return an invalid file descriptor since it is not backed by an FD. It will make pytest croak and hang when invoked through pytest --capture=no on teardown.

The solution is to also forward this to the same code path as with pytest-xdist, where the code already has special handling for.

Hereby, I humbly ask for further guidance in order to bring in this patch. Please let me know

  • if you prefer this mitigation to be handled differently.
  • if you think the respective test case should be adjusted.

With kind regards,
Andreas.

@bluetech bluetech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice description and fix! LGTM, just a couple of comments.

Comment thread changelog/8249.bugfix.rst Resolved
Comment thread testing/test_faulthandler.py Resolved
@nicoddemus nicoddemus added the needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch label Jan 18, 2021
The Twisted Logger will return an invalid file descriptor since it is
not backed by an FD. So, let's also forward this to the same code path
as with `pytest-xdist`.
@amotl
amotl force-pushed the fix-twisted-capture branch from 849fa40 to 9ba1821 Compare January 18, 2021 16:51

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amotl!

@nicoddemus
nicoddemus merged commit bda9ce4 into pytest-dev:master Jan 20, 2021
nicoddemus added a commit to nicoddemus/pytest that referenced this pull request Jan 20, 2021
@nicoddemus

Copy link
Copy Markdown
Member

Backport: #8259

@nicoddemus nicoddemus added backported and removed needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch labels Jan 20, 2021
@amotl

amotl commented Jan 23, 2021

Copy link
Copy Markdown
Contributor Author

Thank you for accepting this small improvement. I wish much success and kudos to all of you for the future development of pytest.

davidgegiya added a commit to davidgegiya/agent-orchestrator that referenced this pull request Nov 8, 2026
…gger and "pytest --capture=no"

Pin 7f782c72ba157aaa26f74553ab328c898dab949c and its regression selectors for reproducible runs.

Source: pytest-dev/pytest#8250
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.

Problem with faulthandler when used with Twisted Logger and "pytest --capture=no"

3 participants