[openlp-dev] Moving to pytest fixtures
Benjamin Hoving
benjamin.hoving at gmail.com
Thu Oct 10 15:33:19 EDT 2019
I also have a branch that exposes some odd behavior. The unittests
all pass locally on my machine, but the tests crash when running in gitlab ci.
Both are running with the pytest runner, but local succeeds and gitlab fails.
I haven't really had a chance to dig into that issue yet. Maybe someone has
some insight on why the tests would pass locally but fail on gitlab?
That same branch also has the application tests re-enabled with no
segfaults, but a couple of the tests do fail. (because of a shared_memory
attribute that doesn't seem to exist in the OpenLP class?)
Here's the branch:
https://gitlab.com/benjaminhoving/openlp/tree/test_fix [https://gitlab.com/benjaminhoving/openlp/tree/test_fix]
On 10/10/2019 1:38:28 AM, Raoul Snyman via openlp-dev <openlp-dev at openlp.io> wrote:
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
_______________________________________________
openlp-dev mailing list
openlp-dev at openlp.io
https://lists.openlp.io/mailman/listinfo/openlp-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openlp.io/pipermail/openlp-dev/attachments/20191010/3452a730/attachment.html>
More information about the openlp-dev
mailing list