[openstack-dev] [nova][testing] How to run a subset of py34 unit tests

Davanum Srinivas davanum at gmail.com
Sat Jan 23 02:59:43 UTC 2016


The following should work as well

source .tox/py34/bin/activate
ostestr --regex *.network.*


On Fri, Jan 22, 2016 at 9:46 PM, melanie witt <melwittt at gmail.com> wrote:
> Hi everyone,
> I noticed because of the way we run the py34 tests in tox.ini, I'm not able to specify a filter regex the way I normally do as a positional arg, for example: 'tox -epy34 nova.tests.unit.network' doesn't filter and it runs everything. ('tox -epy27 nova.tests.unit.network' will only run tests that match nova.tests.unit.network).
> I couldn't figure out how we could add something to tox.ini to make it work -- we're calling ostestr with the --blacklist_file option. I'm not completely clear on what 'ostestr --blacklist_file <file> --regex <regex>' does but I couldn't get it to do what I want. From the documentation [1], it adds --regex to the regex created from the --blacklist_file. The regex from the blacklist file looks something like this '^((?!blacklistedstuff).)*$' and if I can only append to it, the best I could do was a positive lookbehind but that can't match at the beginning of a line. (For example, I tried "ostestr --blacklist_file tests-py3.txt --regex '(?<=network)'" and it matched all the non-blacklisted tests that ended with the word "network"). It seems like what I would need is for --regex to do another re.search() and match the line only if the previous regex from the blacklist also matched.
> As a workaround to run only network tests, I did:
> source .tox/py34/bin/activate
> OS_TEST_PATH=./nova/tests/unit/network ostestr --blacklist_file tests-py3.txt
> Does anyone know a better way?
> Thanks,
> -melanie
> [1] http://docs.openstack.org/developer/os-testr/ostestr.html#test-selection
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Davanum Srinivas :: https://twitter.com/dims

More information about the OpenStack-dev mailing list