[TIP] Skipping with stdlib unittest.py

Frank Niessink frank at niessink.com
Mon Jul 27 13:28:08 PDT 2009


2009/7/27 Michał Kwiatkowski <constant.beta at gmail.com>:
> It is an interesting idea, although it has slightly different
> semantics than the SkipTest used by other test frameworks. If I
> understand your code correctly, decorating a test with @skipOnPlatform
> will cause a test to "dissappear" from a test suite, i.e. it will not
> be reported at all.

Correct.

> In big test suites test cases tend to get lost sometimes, for
> different reasons. I wonder what is your experience with this skip
> test scheme - does it cause tests to get lost from time to time?

We have over 3000 unittests (not counting the 65000 language tests
that are mostly generated). The only reason for "losing" test cases in
my experience is when two test cases have the same name and one hides
the other. This is usually a consequence of copying a test case,
adapting it, but forgetting to change the name.

Measuring coverage (with Ned's coverage.py) of the tests themselves
nicely makes this issue visible. When I started using coverage.py I
found half a dozen of these hidden test cases.

Also, the decorators I mentioned earlier are only used for a couple of
unittests (4 or so I think).

So, overall "losing" test cases is not much of a problem for us.

Cheers, Frank



More information about the testing-in-python mailing list