Fix escaping of regular expressions in tox.ini
With the new version of tox, the interpretation of escaping in the
command section changed [1]. For example, the `tox -e smoke` runs the
following command to execute tempest tests when tox==4.3.5. is installed:
tempest run --regex '[.*\bsmoke\b.*]'
(missing '\' in front of '[', ']') ^^
The issue can be fixed either by adding another backslash ('\\[') or
moving the regular expressions to separate variables. The first solution
won't, however, be backwards compatible with the older version of tox
therefore this patch uses the second approach.
[1] https://tox.wiki/en/latest/config.html#substitutions
Change-Id: Ie5ea7f9305c7e7611f205d2e0703849bd6321a68
diff --git a/tox.ini b/tox.ini
index 618f9e0..e1c17df 100644
--- a/tox.ini
+++ b/tox.ini
@@ -132,10 +132,11 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex = '(^tempest\.scenario.*)|(^tempest\.serial_tests)|(?!.*\[.*\bslow\b.*\])(^tempest\.api)'
# The regex below is used to select all tempest scenario and including the non slow api tests
commands =
find . -type f -name "*.pyc" -delete
- tempest run --regex '(^tempest\.scenario.*)|(^tempest\.serial_tests)|(?!.*\[.*\bslow\b.*\])(^tempest\.api)' {posargs}
+ tempest run --regex {[testenv:full-parallel]regex} {posargs}
[testenv:api-microversion-tests]
envdir = .tox/tempest
@@ -143,11 +144,12 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex = '(^tempest\.api\.compute)|(^tempest\.api\.volume)'
# The regex below is used to select all tempest api tests for services having API
# microversion concept.
commands =
find . -type f -name "*.pyc" -delete
- tempest run --regex '(^tempest\.api\.compute)|(^tempest\.api\.volume)' {posargs}
+ tempest run --regex {[testenv:api-microversion-tests]regex} {posargs}
[testenv:integrated-network]
envdir = .tox/tempest
@@ -155,12 +157,14 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex1 = '(?!.*\[.*\bslow\b.*\])(^tempest\.api)'
+regex2 = '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)'
# The regex below is used to select which tests to run and exclude the slow tag and
# tests listed in exclude-list file:
commands =
find . -type f -name "*.pyc" -delete
- tempest run --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.api)' --exclude-list ./tools/tempest-integrated-gate-networking-exclude-list.txt {posargs}
- tempest run --combine --serial --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)' --exclude-list ./tools/tempest-integrated-gate-networking-exclude-list.txt {posargs}
+ tempest run --regex {[testenv:integrated-network]regex1} --exclude-list ./tools/tempest-integrated-gate-networking-exclude-list.txt {posargs}
+ tempest run --combine --serial --regex {[testenv:integrated-network]regex2} --exclude-list ./tools/tempest-integrated-gate-networking-exclude-list.txt {posargs}
[testenv:integrated-compute]
envdir = .tox/tempest
@@ -168,12 +172,14 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex1 = '(?!.*\[.*\bslow\b.*\])(^tempest\.api)'
+regex2 = '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)'
# The regex below is used to select which tests to run and exclude the slow tag and
# tests listed in exclude-list file:
commands =
find . -type f -name "*.pyc" -delete
- tempest run --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.api)' --exclude-list ./tools/tempest-integrated-gate-compute-exclude-list.txt {posargs}
- tempest run --combine --serial --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)' --exclude-list ./tools/tempest-integrated-gate-compute-exclude-list.txt {posargs}
+ tempest run --regex {[testenv:integrated-compute]regex1} --exclude-list ./tools/tempest-integrated-gate-compute-exclude-list.txt {posargs}
+ tempest run --combine --serial --regex {[testenv:integrated-compute]regex2} --exclude-list ./tools/tempest-integrated-gate-compute-exclude-list.txt {posargs}
[testenv:integrated-placement]
envdir = .tox/tempest
@@ -181,12 +187,14 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex1 = '(?!.*\[.*\bslow\b.*\])(^tempest\.api)'
+regex2 = '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)'
# The regex below is used to select which tests to run and exclude the slow tag and
# tests listed in exclude-list file:
commands =
find . -type f -name "*.pyc" -delete
- tempest run --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.api)' --exclude-list ./tools/tempest-integrated-gate-placement-exclude-list.txt {posargs}
- tempest run --combine --serial --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)' --exclude-list ./tools/tempest-integrated-gate-placement-exclude-list.txt {posargs}
+ tempest run --regex {[testenv:integrated-placement]regex1} --exclude-list ./tools/tempest-integrated-gate-placement-exclude-list.txt {posargs}
+ tempest run --combine --serial --regex {[testenv:integrated-placement]regex2} --exclude-list ./tools/tempest-integrated-gate-placement-exclude-list.txt {posargs}
[testenv:integrated-storage]
envdir = .tox/tempest
@@ -194,12 +202,14 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex1 = '(?!.*\[.*\bslow\b.*\])(^tempest\.api)'
+regex2 = '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)'
# The regex below is used to select which tests to run and exclude the slow tag and
# tests listed in exclude-list file:
commands =
find . -type f -name "*.pyc" -delete
- tempest run --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.api)' --exclude-list ./tools/tempest-integrated-gate-storage-exclude-list.txt {posargs}
- tempest run --combine --serial --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)' --exclude-list ./tools/tempest-integrated-gate-storage-exclude-list.txt {posargs}
+ tempest run --regex {[testenv:integrated-storage]regex1} --exclude-list ./tools/tempest-integrated-gate-storage-exclude-list.txt {posargs}
+ tempest run --combine --serial --regex {[testenv:integrated-storage]regex2} --exclude-list ./tools/tempest-integrated-gate-storage-exclude-list.txt {posargs}
[testenv:integrated-object-storage]
envdir = .tox/tempest
@@ -207,12 +217,14 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex1 = '(?!.*\[.*\bslow\b.*\])(^tempest\.api)'
+regex2 = '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)'
# The regex below is used to select which tests to run and exclude the slow tag and
# tests listed in exclude-list file:
commands =
find . -type f -name "*.pyc" -delete
- tempest run --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.api)' --exclude-list ./tools/tempest-integrated-gate-object-storage-exclude-list.txt {posargs}
- tempest run --combine --serial --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)|(^tempest\.serial_tests)' --exclude-list ./tools/tempest-integrated-gate-object-storage-exclude-list.txt {posargs}
+ tempest run --regex {[testenv:integrated-object-storage]regex1} --exclude-list ./tools/tempest-integrated-gate-object-storage-exclude-list.txt {posargs}
+ tempest run --combine --serial --regex {[testenv:integrated-object-storage]regex2} --exclude-list ./tools/tempest-integrated-gate-object-storage-exclude-list.txt {posargs}
[testenv:full-serial]
envdir = .tox/tempest
@@ -220,12 +232,13 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex = '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|serial_tests))'
# The regex below is used to select which tests to run and exclude the slow tag:
# See the testrepository bug: https://bugs.launchpad.net/testrepository/+bug/1208610
# FIXME: We can replace it with the `--exclude-regex` option to exclude tests now.
commands =
find . -type f -name "*.pyc" -delete
- tempest run --serial --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|serial_tests))' {posargs}
+ tempest run --serial --regex {[testenv:full-serial]regex} {posargs}
[testenv:scenario]
envdir = .tox/tempest
@@ -233,10 +246,11 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex = '(^tempest\.scenario)'
# The regex below is used to select all scenario tests
commands =
find . -type f -name "*.pyc" -delete
- tempest run --serial --regex '(^tempest\.scenario)' {posargs}
+ tempest run --serial --regex {[testenv:scenario]regex} {posargs}
[testenv:smoke]
envdir = .tox/tempest
@@ -244,9 +258,10 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex = '\[.*\bsmoke\b.*\]'
commands =
find . -type f -name "*.pyc" -delete
- tempest run --regex '\[.*\bsmoke\b.*\]' {posargs}
+ tempest run --regex {[testenv:smoke]regex} {posargs}
[testenv:smoke-serial]
envdir = .tox/tempest
@@ -254,12 +269,13 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex = '\[.*\bsmoke\b.*\]'
# This is still serial because neutron doesn't work with parallel. See:
# https://bugs.launchpad.net/tempest/+bug/1216076 so the neutron smoke
# job would fail if we moved it to parallel.
commands =
find . -type f -name "*.pyc" -delete
- tempest run --serial --regex '\[.*\bsmoke\b.*\]' {posargs}
+ tempest run --serial --regex {[testenv:smoke-serial]regex} {posargs}
[testenv:slow-serial]
envdir = .tox/tempest
@@ -267,10 +283,11 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex = '\[.*\bslow\b.*\]'
# The regex below is used to select the slow tagged tests to run serially:
commands =
find . -type f -name "*.pyc" -delete
- tempest run --serial --regex '\[.*\bslow\b.*\]' {posargs}
+ tempest run --serial --regex {[testenv:slow-serial]regex} {posargs}
[testenv:ipv6-only]
envdir = .tox/tempest
@@ -278,12 +295,13 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex = '\[.*\bsmoke|ipv6|test_network_v6\b.*\]'
# Run only smoke and ipv6 tests. This env is used to tests
# the ipv6 deployments and basic tests run fine so that we can
# verify that services listen on IPv6 address.
commands =
find . -type f -name "*.pyc" -delete
- tempest run --regex '\[.*\bsmoke|ipv6|test_network_v6\b.*\]' {posargs}
+ tempest run --regex {[testenv:ipv6-only]regex} {posargs}
[testenv:venv]
deps =
@@ -442,8 +460,9 @@
basepython = {[tempestenv]basepython}
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
+regex = '\[.*\bsmoke\b.*\]'
# The below command install stestr master version and run smoke tests
commands =
find . -type f -name "*.pyc" -delete
pip install -U git+https://github.com/mtreinish/stestr
- tempest run --regex '\[.*\bsmoke\b.*\]' {posargs}
+ tempest run --regex {[testenv:stestr-master]regex} {posargs}