[openstack-dev] [nova] fastest way to run individual tests ?
Nikola Đipanov
ndipanov at redhat.com
Fri Jul 11 08:24:33 UTC 2014
On 07/09/2014 10:51 PM, Matt Riedemann wrote:
>
>
> On 6/12/2014 6:17 AM, Daniel P. Berrange wrote:
>> On Thu, Jun 12, 2014 at 07:07:37AM -0400, Sean Dague wrote:
>>> On 06/12/2014 06:59 AM, Daniel P. Berrange wrote:
>>>> Does anyone have any tip on how to actually run individual tests in an
>>>> efficient manner. ie something that adds no more than 1 second penalty
>>>> over & above the time to run the test itself. NB, assume that i've
>>>> primed
>>>> the virtual env with all prerequisite deps already.
>>>>
>>>
>>> The overhead is in the fact that we have to discover the world, then
>>> throw out the world.
>>>
>>> You can actually run an individual test via invoking the testtools.run
>>> directly:
>>>
>>>> python -m testtools.run nova.tests.test_versions
>>>
>>> (Also, when testr explodes because of an import error this is about the
>>> only way to debug what's going on).
>>
>> Most excellent, thankyou. I knew someone must know a way to do it :-)
>>
>> Regards,
>> Daniel
>>
>
> I've been beating my head against the wall a bit on unit tests too this
> week, and here is another tip that just uncovered something for me when
> python -m testtools.run and nosetests didn't help.
>
> I sourced the tox virtualenv and then ran the test from there, which
> gave me the actual error, so something like this:
>
> source .tox/py27/bin/activate
> python -m testtools.run <test>
>
> Props to Matt Odden for helping me with the source of the venv tip.
>
FWIW - this is what ./run_tests.sh -d does but also prepends the
lockutils invocation Vish mentioned that is needed for some tests to run.
I've also noticed several bugs when running functional tests this way,
especially those that start services and parse config options when we
don't load the whole world, which no one seems to be fixing, so I
assumed that usage of this was not very widespread (I assume bcz ppl
used tox).
N.
PS. Now that I think about it - I've also not submitted fixes for them... :)
More information about the OpenStack-dev
mailing list