<div dir="ltr">Hi Victor,<div><br></div><div>This page is worth it : <a href="https://wiki.openstack.org/wiki/Testr">https://wiki.openstack.org/wiki/Testr</a></div><div class="gmail_extra">Comments inline.</div><div class="gmail_extra">
<br></div><div class="gmail_extra">-Sylvain<br><br><div class="gmail_quote">2014-04-08 10:13 GMT+02:00 victor stinner <span dir="ltr"><<a href="mailto:victor.stinner@enovance.com" target="_blank">victor.stinner@enovance.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
I have some issues when running unit tests in OpenStack. I would like to help, but I don't know where I should start and how I can fix these bugs. My use case is to run unit tests and rerun a single test if one or more tests failed. Well, it should be the most basic use case, no?<br>
<br>
<br>
(1) First problem: if a Python module cannot be loaded, my terminal is flooded with a binary stream which looks like:<br>
<br>
... tCase.test_deprecated_without_replacement\xd7\xe1\x06\xa1\xb3)\x01@l@atests.unit.test_versionutils.DeprecatedTestCa ...<br>
<br>
IMO it's a huge bug in the testr tool: "testr run" command should not write binary data into stdout. It makes development very hard.<br>
<br></blockquote><div><br></div><div><br></div><div>That's happening when testr is trying to locate all unittests classes. Switching to nosetests without parrallelism can help, as the traceback is shown there.</div><div>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
(2) When a test fails, it's hard to find the command to rerun a single failing test.<br>
<br>
Using the tool trial, I can just copy/paste the "FQDN" name of the failing test and run "trial FQDN". Example:<br>
<br>
trial tests.unit.test_timeutils.TestIso8601Time.test_west_normalize<br>
<br>
Using the tool nosetests, you have to add a column between the module and the method. Example:<br>
<br>
nosetests tests.unit.test_timeutils:TestIso8601Time.test_west_normalize<br>
<br>
Using tox, in most OpenStack projects, adding the name of the failing test to the tox command is usually ignored. I guess that it's an issue with tox.ini of the project? tox rerun the whole test suite which is usually very slow (it takes some minutes even on fast computer). Example:<br>
<br>
tox -e py27 tests.unit.test_timeutils.TestIso8601Time.test_west_normalize<br>
<br>
I try sometimes to activate the virtualenv and then type:<br>
<br>
testr run tests.unit.test_timeutils.TestIso8601Time.test_west_normalize<br>
<br>
It usually fails for different reasons.<br>
<br>
Example with python-swiftclient. I run unit tests using "tox -e py33. Some tests are failing. I enter the virtual environment and type the following command to rerun a failing test:<br>
<br>
testr run tests.test_swiftclient.TestPutObject.test_unicode_ok<br>
<br>
The test is not run again, no test is run. It's surprising because the same command works with Python 2. It's probably a bug in testr?<br>
<br>
<br></blockquote><div><br></div><div>See the wiki page I gave to you. Some helpful tricks are there. That said, I never had the issue you mentioned related to only checking one unittest by providing the path.</div><div>When I'm isolating one test, tox -epy27 <pattern> is enough for me. Run_tests.sh also accepts <pattern>, which is not necessarly the full python path for the class or the classmethod to be checked.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
(3) testscenarios doesn't work with nosetests. It's annoying because for the reasons listed above, I prefer to run tests using nosetests. Why do we use testscenarios and not something else? Do we plan to support nosetests (and other Python test runners) for testscenarios?<br>
<br>
<br></blockquote><div><br></div><div>You can run testtools without testr. Nosetests has been marked as non-supported, IIRC.</div><div><br></div><div>-Sylvain</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Victor<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</blockquote></div><br></div></div>