[TIP] Skipping with stdlib unittest.py

C. Titus Brown ctb at msu.edu
Fri Jul 24 09:43:58 PDT 2009


On Fri, Jul 24, 2009 at 11:30:08AM -0500, John Arbash Meinel wrote:
-> -----BEGIN PGP SIGNED MESSAGE-----
-> Hash: SHA1
-> 
-> Jean-Paul Calderone wrote:
-> > Hi all,
-> > 
-> > I'm curious about what other people do when they're using the stdlib unittest
-> > module and need to skip tests.  Fortunately, in Python 2.7, skipping features
-> > will be added, but what have people been doing up until now?
-> > 
-> > Jean-Paul
-> 
-> Writing their own.
-> 
-> bzr, for example, hooks into the TestResult.addError to check to see if
-> this exception is actually a "TestSkipped" exception, and then changes
-> how the result is reported.

Yes, we've done the same thing in pygr, which is nose- and py.test-
free.  You can see our extension here,

http://github.com/ctb/pygr/blob/5fde226724279f50135b15eb5a3a7c3ec02294be/tests/testlib/unittest_extensions.py

and example use at the veeeeeeery bottom of this file:

http://github.com/ctb/pygr/blob/5fde226724279f50135b15eb5a3a7c3ec02294be/tests/blast_test.py

cheers,
--titus
-- 
C. Titus Brown, ctb at msu.edu



More information about the testing-in-python mailing list