1

Does PyQt has support for QTest macros like QVERIFY and more importantly QTRY_VERIFY etc

I've looked around but couldn't find it but maybe I'm overlooking something

If not, what is the best way to support this functionality? I'd rather not use qtbot since we are using both Python and C++ and I prefer to use the same testing framework on both code bases.

Marc Van Daele
  • 2,856
  • 1
  • 26
  • 52
  • 2
    No. You cannot use `QTest` without `unittest`. What do those macros do that python's [assert methods](https://docs.python.org/3/library/unittest.html#assert-methods) can't do? – ekhumoro Jan 11 '19 at 14:39
  • That's indeed true for eg QVERIFY but not for the QTRY* macros. These "evaluate a condition repeatedly until it becomes true or the timeout (in milliseconds) is reached. Between each comparison, events will be processed" This is a convenient macro to check whether a widget becomes visible (or enabled) ... , especially useful when we can't spy on signals – Marc Van Daele Jan 11 '19 at 15:11
  • I don't see any reason why you can't write a wrapper function that does the same thing. I suggest you take a look at [*qtbase/src/testlib/qtestcase.h*](https://code.qt.io/cgit/qt/qtbase.git/tree/src/testlib/qtestcase.h) and port whatever bits you actually need. – ekhumoro Jan 11 '19 at 17:30
  • Thanks for the pointer. That's definitely feasible. But I was wondering whether it was part of PyQt. I guess it isn't? – Marc Van Daele Jan 12 '19 at 00:27
  • This isn't really the right place to discuss things like this, since the author of pyqt will never see any of it. If you want to know whether these macros could ever become part of pyqt, you should ask on the [pyqt mailing list](https://www.riverbankcomputing.com/mailman/listinfo/pyqt). – ekhumoro Jan 12 '19 at 00:33

0 Answers0