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

melanie witt melwittt at gmail.com
Sat Jan 23 02:46:48 UTC 2016

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?


[1] http://docs.openstack.org/developer/os-testr/ostestr.html#test-selection

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160122/b8977dbb/attachment.pgp>

More information about the OpenStack-dev mailing list