[TIP] Which unittest extensions are very important in current test practices?

Robert Collins robertc at robertcollins.net
Sun May 15 18:06:34 PDT 2016


On 28 April 2016 at 02:30, Brian Okken <variedthoughts at gmail.com> wrote:
> I'm trying to pull together all of the relevant useful extensions to
> unittest.
>
> There are lots of extensions to unittest.
>
> This is obvious:
>
> * mock (still an extension for 2.7, built in to 3.5)

mock is a rolling backport - so it provides fixes even to 3.5 vs the
builds that are in released Linux distributions (not to mention
3.3/'3.4).

> These look current from github activity. Are they still important?
>
> * testtools
> * fixtures
>
> These ... I'm not sure ... Are they still important?
>
> * testscenarios

This is definitely still useful - its more general than subtests
(which are available on 2.x and older 3.x releases via unittest2).

> * testresources

I'd like to converge the testresources / fixtures API's, but I haven't
had time to do that - and noone has profferred a fix - its probably
fairly involved, conceptually anyway. For now, if you have expensive
things like databases you can either carefully nest your test suite,
use zope.testrunner's layers, or testresources - which just uses
annotated tests to figure out a good order to run your tests in.

> * testrepository

> And this looks interesting, but is it still important?
>
> * subunit

Its an enabler for testrepository, and testrepository is pretty useful
for slow test environments, or CI / remote test environments. The
schema in subunit is approximately as valiuable as the actual wire
protocol - there are lots of ways to get information from A to B after
all.

Cheers,
ROb



More information about the testing-in-python mailing list