[TIP] tests speed

andrea crotti andrea.crotti.0 at gmail.com
Mon Mar 4 04:36:51 PST 2013


Hi everyone
I realized why our tests are taking so embarassingly long time to
execute.

Basically we use bottle which declares views everywhere with
"@app.post/@app.get".

But we also have many 20 different directories where there are routing
declarations, so *every* time I run the tests basically I'm importing
the whole system, even if I'm testing maybe 1/10 or less.

That's a bit annoying, but not sure how to solve it because it's how
bottle routing is supposed to be used...

I would prefer to have a urls.py in django-style, which seems to be
still possible, and then as long as I don't import urls.py I don't have
to import the whole API..
Any other ways?


2013/2/13 Chris Jerdonek <chris.jerdonek at gmail.com>:
> On Wed, Feb 13, 2013 at 5:40 AM, andrea crotti
> <andrea.crotti.0 at gmail.com> wrote:
>> I'm trying to make sure that all my tests run as fast as possible, and
>> they actually do:
>>
>> Ran 44 tests in 0.011s
>
> Here is where unittest's default TextTestRunner measures the time
> (which is after test discovery/loading/etc):
>
> http://hg.python.org/cpython/file/659ef9d360ae/Lib/unittest/runner.py#l163
>
> I don't know whether nose uses a custom test runner that measures
> things differently.
>
> --Chris
>
>
>>
>> But the problem is that the actual time they take to run is much different:
>>
>> OK
>>
>> real    0m12.105s
>> user    0m11.873s
>> sys     0m0.170s
>>
>>
>> where are these 12 seconds being lost then? (using nose)
>>
>> _______________________________________________
>> testing-in-python mailing list
>> testing-in-python at lists.idyll.org
>> http://lists.idyll.org/listinfo/testing-in-python



More information about the testing-in-python mailing list