[TIP] Bug with nosetests? Adding a new case with autospec=True will take 15 seconds

John Wong gokoproject at gmail.com
Wed Mar 6 17:31:04 PST 2013


Just a follow-up.

I made a mistake not including the files.
The repo is updated:
https://bitbucket.org/yeukhon/bitbucket-python-api/src/18ddb36b9c7c7297398a6e97b889ddfc9b5e5ae8/tests/small?at=default

Simple version:

Basically, I wanted to add a new test class.
The new test case in that class is test_account_creation.

I ran nosetests on all of them. It took 15 seconds. Wow.

I commented that test case out, it was running about 1 second. Okay. That's
what I meant when test_account_creation exist or deleted. I gave the
results whenautospec=True/False in the patch (see base.py), and results
when the new test casetest_account_creation was un/commented.


Thanks.


On Tue, Mar 5, 2013 at 10:57 PM, John Wong <gokoproject at gmail.com> wrote:

> HI,
>
> Thanks for all the help so far.
>
> Here is the repo:
> https://bitbucket.org/yeukhon/bitbucket-python-api/src/6e57e95d5d09/tests/small?at=default
>
> I have a base unit test class in base.py.  For test_bitbucket.py, I
> inherit from the base unit test class.
> I want to add new test cases and classes to test_bitbucket.py While doing
> so, I discovered performance issue.
>
> I ran `nosetests` inside tests/small and I am getting these mix results
>
>
> Ran 18 tests in 14.523s        - autospec=True and test_account_creation
> exists
>
> Ran 18 tests in 0.621s         - autospec=False and
> test_account_creation_exists
>
>
> Ran 17 tests in 1.081s         - autospec=True and test_account_creation
> is deleted
>
> Ran 17 tests in 0.090s         - autospec=False, and test_account_creation
> is deleted
>
>
> I understand requests is a big library, but the performance hit is crazy,
> going from 1.1s to 14.5s with and without the new test class, respectively.
>
> Interestingly, if we run test_bitbucket.py individually.
>
> (bbpy)yeukhon at yeukhon-P5E-VM-DO:~/hg/bitbucket-python-api/tests/small$
> nosetests test_bitbucket.py
> ...
> ----------------------------------------------------------------------
> Ran 3 tests in 0.090s
>
> OK
>
>
> Pretty much the same with/without autospec on.
>
> Any idea? I don't know enough about nosetests internal.
>
> Thanks!
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20130306/c5af2c57/attachment.htm>


More information about the testing-in-python mailing list