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

John Wong gokoproject at gmail.com
Tue Mar 5 19:57:29 PST 2013


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/20130305/a7475faa/attachment.htm>


More information about the testing-in-python mailing list