[TIP] Getting Weird Coverage Reports

Tom Davis tom at recursivedream.com
Fri Nov 25 07:38:48 PST 2011



On Nov 25, 2011, at 7:27 AM, John Anderson <sontek at gmail.com> wrote:

> 
> 
> Hi John, 
> 
> This is a similar problem that the Pecan [0] framework had (still?) for exposing configuration setup for the actual application
> at test time.
> 
> The problem is (as you suspect) that the configuration in pytest_configure happens *before* any of the mechanisms for coverage start.
> 
> My suggestion would be not to use this and to try and have a base class that you can use for your tests that include this configuration and
> database setup. 
> 
> The problem is I only want to run this once for *all* my tests, just to start in a clean slate.  I don't want to run it per sets of test.   It *does* work if I put it in setUpClass of my Base test class but it takes my tests from 5sec to 30sec because its dropping and recreating the db for each set of tests.

FWIW, you should be able to define setUpModule() in each test module you want this per-run support in. Obviously not a perfect solution given the duplication, but better than 6x slow down!

-Tom

> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20111125/256df051/attachment-0001.htm>


More information about the testing-in-python mailing list