On lundi, 27 mars 2023 22.23:02 h CEST Stefan Seefeld wrote: > Hello, > > I'm working on some Python tests that interact with a Qt application. I > would like to run the application's event loop in a secondary thread, so > the primary thread can perform the test itself. > > I read in the past that such a use-case wasn't supported by Qt, but I can't > find that information right now, and neither do I remember the rationale > for that limitation. > > Could anybody please either confirm or deny this limitation, ideally with > some background information ? > > For context: my application is somewhat atypical in that the application > only has a minimal GUI, but does a lot of processing of input from TCP/IP. > The test logic I'd like to write would thus have test function (running in > the primary thread) control the data sent to the app and inspect and assert > the application's corresponding states, while the event processing would > take place in a secondary thread. > > I'm unfortunately not sure that such a use-case is possible at all, i.e. I > may have to invert roles, i.e. have the actual "test scenario" be executed > in a secondary thread as the main thread is reserved for the (blocking) > event loop. > > Thanks for any information & suggestions ! > > ...ich hab' noch einen Koffer in Berlin...
Hi, Did you consider the use of pytest-qt[0] ? It allows to test the various aspects of your widgets and other Qt based business logic without having to manage yourself the creation of a QApplication object or the need to add threads. Best regards Samuel [0]https://pytest-qt.readthedocs.io/en/latest/intro.html
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest