[Deepsea-users] Choosing unittesting frameworks

Nathan Cutler ncutler at suse.cz
Tue Jan 31 06:06:01 MST 2017

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

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?

Nathan Cutler
Software Engineer Distributed Storage
SUSE LINUX, s.r.o.
Tel.: +420 284 084 037

More information about the Deepsea-users mailing list