pytest-dev / pytest-dev/pytest-qt

More verbose tracebacks on exceptions in event loop

Open
#541 1 comment 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

When an exception happens during the event loop, only a tight traceback is printed.

  File "D:\tmp\tox\py39-PyQt5-all\lib\site-packages\napari\utils\events\containers\_evented_list.py", line 195, in insert
      self.events.inserted(index=index, value=value)
    File "D:\tmp\tox\py39-PyQt5-all\lib\site-packages\napari\utils\events\event.py", line 763, in __call__
      self._invoke_callback(cb, event if pass_event else None)
    File "D:\tmp\tox\py39-PyQt5-all\lib\site-packages\napari\utils\events\event.py", line 801, in _invoke_callback
      _handle_exception(
    File "D:\tmp\tox\py39-PyQt5-all\lib\site-packages\napari\utils\events\event.py", line 788, in _invoke_callback
      cb(event)

But it is often not very helpful to debug.

pytest support rich tracebacks https://docs.pytest.org/en/7.1.x/how-to/output.html#modifying-python-traceback-printing

Will you accept PR with such enhancement?

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 by reading napari's event.py around _invoke_callback and _handle_exception, with _evented_list.py showing the reported traceback path. Compare the current exception output with pytest's rich traceback documentation. Done means exceptions raised during the event loop provide a more useful, verbose traceback, with coverage for the changed behavior.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.