How many times does unittest run each test?

Roy Smith roy at panix.com
Sat Aug 10 16:40:43 EDT 2013


In article <f7b24010-f3f4-4e86-b6c4-9ddb503d0412 at googlegroups.com>,
 Josh English <Joshua.R.English at gmail.com> wrote:

> I am working on a library, and adding one feature broke a seemingly unrelated 
> feature. As I already had Test Cases written, I decided to try to incorporate 
> the logging module into my class, and turn on debugging at the logger before 
> the newly-broken test.
> 
> Here is an example script:
[followed by 60 lines of code]

The first thing to do is get this down to some minimal amount of code 
that demonstrates the problem.

For example, you drag in the logging module, and do some semi-complex 
configuration.  Are you SURE your tests are getting run multiple times, 
or maybe it's just that they're getting LOGGED multiple times.  Tear out 
all the logging stuff.  Just use a plain print statement.

You've got two different TestCases here.  Does the problem happen with 
just LoaderTC, or with just NameSpaceTC?

Keep tearing out code until you can no longer demonstrate the problem.  
Keep at it until there is not a single line of code remaining which 
isn't required to demonstrate.  Then come back and ask your question 
again.



More information about the Python-list mailing list