[openlp-dev] Moving to pytest fixtures

Raoul Snyman raoul at snyman.info
Tue Oct 8 16:42:24 EDT 2019


Hello everyone!

A while back we decided to switch to using pytest[0] for running our 
tests. It's much faster than nose[1], and pretty actively developed. For 
the most part, pytest can run tests written for the built-in unittest[2] 
framework (which is what nose uses). Unfortunately there seem to be some 
unintended consequences of this, and that is that sometimes the OpenLP 
application object is not disposed of correctly, causing segfaults. 
We've been skipping the tests for the OpenLP application object because 
of this[3].

Benjamin was running into this issue[4], and being familiar with pytest, 
figured he should use pytest fixtures (aka, The Right Way) to fix this 
problem. Because of our history of nose -> nose2 -> pytest, we haven't 
actually converted our tests to use pytest fixtures[5]. You can think of 
a fixture as a way to run the setUp and tearDown methods without needing 
a class.

I'd like to propose that we move to pytest fully. This, like all things, 
will need to be an incremental change, but I reckon we can probably 
start with the OpenLP application object tests.

What do you guys think?


[0] https://pytest.org/en/latest/
[1] https://docs.nose2.io/en/latest/
[2] https://docs.python.org/3/library/unittest.html
[3] 
https://gitlab.com/openlp/openlp/blob/master/tests/functional/openlp_core/test_app.py#L161
[4] https://gitlab.com/openlp/openlp/merge_requests/19
[5] https://pytest.org/en/latest/fixture.html

-- 
Raoul Snyman
raoul at snyman.info


More information about the openlp-dev mailing list