pyunit: remove a test case on the fly

chris chris.levis at gmail.com
Wed Jun 15 17:13:09 EDT 2005


We have a number of TestCase classes that have multiple test methods.
We are interested in removing any of the individual test methods on the
fly (dynamically, at runtime, whatever).

We currently have an "isSupported" method in the TestCase classes that
return a bool by which the greater test harness decides whether to run
the enclosed test methods or not.  We would like to have
per-test-method granularity, however, for essentially skipping that
particular test method;  basically another isSupported call within the
individual methods.  We took a quick look at such options as:
generating the entire test suite, then iterating through and renaming
SomeTestClass.testSomeTest to SomeTestClass.SKIPsomeTest, and seeing if
PyUnit would skip it (since the method name no longer starts with
"test").  But this seemed pretty unwieldy.  We have also considered
breaking up the test class to a number of smaller test classes and
calling isSupported with that finer-granularity set of test classes.
That is probably the easiest way, but we do still want to consider
alternatives.

Here's to hoping that other folks out there have had experience with
removing test methods on the fly, and have some wisdom to share.

Cheers




More information about the Python-list mailing list