Skip to content

Catching exceptions in Qt virtual methods

Compare
Choose a tag to compare
@nicoddemus nicoddemus released this 31 May 22:10
· 1038 commits to master since this release
  • Added stop as an alias for stopForInteraction (#10, thanks @itghisi)
  • Now exceptions raised in virtual methods make tests fail, instead of silently passing (#11). If an exception is raised, the test will fail and it exceptions that happened inside virtual calls will be printed as such:
E           Failed: Qt exceptions in virtual methods:
E           ________________________________________________________________________________
E             File "x:\pytest-qt\pytestqt\_tests\test_exceptions.py", line 14, in event
E               raise ValueError('mistakes were made')
E
E           ValueError: mistakes were made
E           ________________________________________________________________________________
E             File "x:\pytest-qt\pytestqt\_tests\test_exceptions.py", line 14, in event
E               raise ValueError('mistakes were made')
E
E           ValueError: mistakes were made
E           ________________________________________________________________________________

Thanks to @jdreaver for request and sample code!

  • Fixed documentation for QtBot: it was not being rendered in the docs due to an import error.