[Deepsea-users] Choosing unittesting frameworks

Joshua Schmid jschmid at suse.de
Tue Jan 31 06:28:22 MST 2017

On 01/31/2017 02:06 PM, Nathan Cutler wrote:
> I asked Loic, here's his reply:
> (01:55:08 PM) loicd: pytest is *wwwaaaaaaay* better
> (02:01:38 PM) smithfarm: can I quote you? ;-)
> (02:01:47 PM) loicd: yes
> (02:02:18 PM) loicd: seriously, there is nothing but pytest nowadays

that's a clear statement :)
> On 01/31/2017 01:12 PM, Joshua Schmid wrote:
>> Hey list,
>> first of all I'd like to get the terminology straight.
>> We use 'tox' serves us as a virtualenv manager and allows us:
>> * checking your package installs correctly with different Python
>> versions and interpreters
>> * running your tests in each of the environments, configuring your test
>> tool of choice
>> * acting as a frontend to Continuous Integration servers, greatly
>> reducing boilerplate and merging CI and shell-based testing.
>> tox internally executes 'pytest' which acts currently (for us) as a
>> testcollector that scans directories for 'test_*' files or methods
>> starting with 'test_'.
>> pytest could be replaced with nosetests but after reading some articles
>> pytest seem to have more functionality and a bigger user-base.
>> pytest does not solely act act as a testcollector and runner, but is
>> also a full-fledged unittest framework.
>> as we are moving towards more unittesting, we should agree _now_ on one
>> framework. I for example picked the native python 'unittest' library
>> because it's widespread and has a rather complete documentation.
>> Abhi otoh went for 'pytest'. After some reading I see some benefits in
>> also switching to it.
>> benefits suchs as:
>> * writing setup_functions for specific blocks of tests rather than for
>> an entire test class.
>> * less boilerplate assert vs self.asserTrue(e.g)
>> we also will use mocking quite extensively. We have only one options
>> here: Mock, which is a standalone lib in py2.7 but was adopted in the
>> native unittest lib in py3.x. (There is also a thin wrapper for pytest
>> called pytest-mocker but this is out of scope here I guess.)
>> I don't have a strong opinion because I basically just started reading..
>> If anyone has a profound python background, please speak up now :)
>> I currently lean towards pytest + mock.
>> Thoughts?

Freundliche Grüße - Kind regards,
Joshua Schmid
SUSE Enterprise Storage
SUSE Linux GmbH - Maxfeldstr. 5 - 90409 Nürnberg
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard,
Jennifer Guild, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg)

More information about the Deepsea-users mailing list