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.

--

Thanks,

Matt Riedemann


_______________________________________________
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to