[Python-ideas] @unittest.skip_others decorator

Terry Reedy tjreedy at udel.edu
Tue Aug 17 01:34:27 CEST 2010


On 8/16/2010 4:37 PM, Giampaolo Rodolà wrote:
> Hello,
> when working on a test suite, no matter if writing new test cases from
> scratch or modifying an existing one, the need of temporarily
> excluding other tests and focus on that particular one is very common
> (at least for me).
> This is especially true when working on a test suite which contains a
> lot of tests producing a very verbose output result or which takes a
> lot to complete.
>
> What I usually do in such cases is to scroll down until test_main()
> function, manually change support.run_unittest() ilke this:
>
> -    support.run_unittest(TestCase1, TestCase2, TestCase3, TestCase4)
> +    support.run_unittest(TestCase4)
>
> ...and then comment out all the test cases in TestCase4 class except
> the one I'm interested in.

How about using a special TestDevelopment with only the test cases you 
are working on? Then comment out the standard run and uncomment the 
development run

# support.run_unittest(TestCase1, TestCase2, TestCase3, TestCase4)
support.run_unittest(TestDevel)

When done, move tests to whichever regular TestCase they belong in.
-- 
Terry Jan Reedy





More information about the Python-ideas mailing list