pytest-dev / pytest-dev/pytest-qt

Can we print fatal Qt messages despite `abort()`?

Open
#450 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
455
Forks
72
Avg merge
12h 26m
Merged PRs (30d)
1

Description

As outlined in Troubleshooting — pytest-qt documentation, when Qt calls abort, often the user doesn't have any useful information due to pytest's output capturing.

I can see two ways around this, which might be worth exploring:

  • Disable pytest output capturing while creating a QApplication
  • Use qInstallMessageHandler to set up a custom message handler which prints some messages (fatal ones, at least) to a separate non-captured output stream (like faulthandler support in pytest)

Not sure if (especially the first one) could get too noisy though, Qt might print some unrelated stuff at startup maybe...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Troubleshooting — pytest-qt documentation section and the code path that creates a QApplication. Compare disabling pytest output capturing with using qInstallMessageHandler to send fatal Qt messages to a separate non-captured stream, then verify fatal messages remain visible without excessive unrelated startup output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.