[openlp-dev] Moving to pytest fixtures

Raoul Snyman raoul at snyman.info
Thu Oct 10 01:38:23 EDT 2019


So I did some more digging... some observations:

1. The segfaults I'm running into are all in pytest's collection phase.
2. After a bunch of messing around I found two segfaults:
    - In settings.py, setting shortcuts when creating a new Settings 
object
    - In icons.py, getting the palette when creating a new UiIcons object
3. Both segfaults are due to no QApplication object existing at the 
time.

 From this I can surmise that when collecting tests, pytest somehow runs 
the test methods, but doesn't run setUp or tearDown. Another reason to 
move to pytest fixtures, I guess.

With some defensive programming techniques in those two classes, I was 
able to get past collection. I re-enabled the application tests, and now 
I'm running into a segfault there, but it's at least further than I was 
previously getting.

Additionally, I removed the "global" QApplication object, and I 
introduced a "teardown_application()" to remove the app object.

I've pushed this code up to here, if anyone is interested:

https://gitlab.com/superfly/openlp/commit/6736c02c2dcc57343ca5a9e764fbf98a4c5c67e1

-- 
Raoul Snyman
raoul at snyman.info


More information about the openlp-dev mailing list