Browse Source

Be explicit about tox python version

We want to default all jobs to use python 3 except for
the ones that use explicit versions. Unfortunately, the
current tox behavior for setting basepython to python3
is not intuitive.

If the system default is python 3.5, then when basepython
is set to python3, both the py35 and py36 targets will
end up running with python 3.5.

To get around this we need to not set a default base
version and explicitly set each testenv to python3 that
we want to run using 3 instead of 2 but do not really
care which minor version is used.

Change-Id: I3971eeafbd1e732a584b0c52d2eb6c2175b709aa
tags/13.0.0.0b3
Sean McGinnis 11 months ago
parent
commit
5542de51bc
1 changed files with 17 additions and 1 deletions
  1. 17
    1
      tox.ini

+ 17
- 1
tox.ini View File

@@ -4,7 +4,6 @@ skipsdist = True
4 4
 envlist = py35,py27,compliance,pep8
5 5
 
6 6
 [testenv]
7
-basepython = python3
8 7
 setenv = VIRTUAL_ENV={envdir}
9 8
          PYTHONWARNINGS=default::DeprecationWarning
10 9
          OS_STDOUT_CAPTURE=1
@@ -31,6 +30,7 @@ whitelist_externals =
31 30
 passenv = *_proxy *_PROXY
32 31
 
33 32
 [testenv:api-ref]
33
+basepython = python3
34 34
 whitelist_externals = rm
35 35
 deps =
36 36
     -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
@@ -40,6 +40,7 @@ commands =
40 40
   sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html/
41 41
 
42 42
 [testenv:releasenotes]
43
+basepython = python3
43 44
 deps =
44 45
   -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
45 46
   -r{toxinidir}/requirements.txt
@@ -61,10 +62,12 @@ setenv =
61 62
   {[testenv:functional]setenv}
62 63
 
63 64
 [testenv:compliance]
65
+basepython = python3
64 66
 setenv =
65 67
   OS_TEST_PATH = ./cinder/tests/compliance
66 68
 
67 69
 [testenv:pep8]
70
+basepython = python3
68 71
 commands =
69 72
   python setup.py check --restructuredtext --strict
70 73
   flake8 {posargs} .
@@ -72,12 +75,14 @@ commands =
72 75
   {toxinidir}/tools/check_exec.py {toxinidir}/cinder {toxinidir}/doc/source/ {toxinidir}/releasenotes/notes
73 76
 
74 77
 [testenv:fast8]
78
+basepython = python3
75 79
 # Use same environment directory as pep8 env to save space and install time
76 80
 envdir = {toxworkdir}/pep8
77 81
 commands =
78 82
   {toxinidir}/tools/fast8.sh
79 83
 
80 84
 [testenv:pylint]
85
+basepython = python3
81 86
 deps = -r{toxinidir}/requirements.txt
82 87
        pylint==1.9.1
83 88
 commands = bash tools/lintstack.sh
@@ -85,6 +90,7 @@ commands = bash tools/lintstack.sh
85 90
 [testenv:cover]
86 91
 # Also do not run test_coverage_ext tests while gathering coverage as those
87 92
 # tests conflict with coverage.
93
+basepython = python3
88 94
 setenv =
89 95
     {[testenv]setenv}
90 96
     PYTHON=coverage run --source cinder --parallel-mode
@@ -95,23 +101,28 @@ commands =
95 101
     coverage xml -o cover/coverage.xml
96 102
 
97 103
 [testenv:genconfig]
104
+basepython = python3
98 105
 sitepackages = False
99 106
 envdir = {toxworkdir}/pep8
100 107
 commands = oslo-config-generator --config-file=tools/config/cinder-config-generator.conf
101 108
 
102 109
 
103 110
 [testenv:genpolicy]
111
+basepython = python3
104 112
 commands = oslopolicy-sample-generator --config-file=tools/config/cinder-policy-generator.conf
105 113
 
106 114
 [testenv:genopts]
115
+basepython = python3
107 116
 sitepackages = False
108 117
 envdir = {toxworkdir}/pep8
109 118
 commands = python tools/config/generate_cinder_opts.py
110 119
 
111 120
 [testenv:venv]
121
+basepython = python3
112 122
 commands = {posargs}
113 123
 
114 124
 [testenv:docs]
125
+basepython = python3
115 126
 deps =
116 127
   -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
117 128
   -r{toxinidir}/requirements.txt
@@ -125,15 +136,18 @@ commands =
125 136
 whitelist_externals = rm
126 137
 
127 138
 [testenv:gendriverlist]
139
+basepython = python3
128 140
 sitepackages = False
129 141
 envdir = {toxworkdir}/venv
130 142
 commands = python {toxinidir}/tools/generate_driver_list.py
131 143
 
132 144
 [testenv:bandit]
145
+basepython = python3
133 146
 deps = -r{toxinidir}/test-requirements.txt
134 147
 commands = bandit -r cinder -n5 -x tests -ll
135 148
 
136 149
 [testenv:bandit-baseline]
150
+basepython = python3
137 151
 envdir = {toxworkdir}/bandit
138 152
 commands = bandit-baseline -r cinder -n5 -x tests -ii -ll
139 153
 
@@ -144,6 +158,7 @@ commands = bandit-baseline -r cinder -n5 -x tests -ii -ll
144 158
 # separately, outside of the requirements files, and develop mode disabled
145 159
 # explicitly to avoid unnecessarily installing the checked-out repo too (this
146 160
 # further relies on "tox.skipsdist = True" above).
161
+basepython = python3
147 162
 deps = bindep
148 163
 commands = bindep test
149 164
 usedevelop = False
@@ -164,6 +179,7 @@ local-check-factory = cinder.hacking.checks.factory
164 179
 import_exceptions = cinder.i18n
165 180
 
166 181
 [testenv:lower-constraints]
182
+basepython = python3
167 183
 deps =
168 184
   -c{toxinidir}/lower-constraints.txt
169 185
   -r{toxinidir}/test-requirements.txt

Loading…
Cancel
Save