OpenStack Compute (Nova)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tox.ini 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. [tox]
  2. minversion = 3.1.1
  3. envlist = py27,py37,functional,pep8
  4. # Automatic envs (pyXX) will only use the python version appropriate to that
  5. # env and ignore basepython inherited from [testenv] if we set
  6. # ignore_basepython_conflict.
  7. ignore_basepython_conflict = True
  8. [testenv]
  9. basepython = python3
  10. usedevelop = True
  11. whitelist_externals =
  12. bash
  13. find
  14. rm
  15. env
  16. make
  17. setenv =
  18. VIRTUAL_ENV={envdir}
  19. LANGUAGE=en_US
  20. LC_ALL=en_US.utf-8
  21. OS_STDOUT_CAPTURE=1
  22. OS_STDERR_CAPTURE=1
  23. OS_TEST_TIMEOUT=160
  24. PYTHONDONTWRITEBYTECODE=1
  25. # TODO(stephenfin): Remove psycopg2 when minimum constraints is bumped to 2.8
  26. PYTHONWARNINGS = ignore::UserWarning:psycopg2
  27. deps =
  28. -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  29. -r{toxinidir}/requirements.txt
  30. -r{toxinidir}/test-requirements.txt
  31. passenv =
  32. OS_DEBUG GENERATE_HASHES
  33. # there is also secret magic in subunit-trace which lets you run in a fail only
  34. # mode. To do this define the TRACE_FAILONLY environmental variable.
  35. commands =
  36. stestr run {posargs}
  37. env TEST_OSPROFILER=1 stestr run --combine --no-discover 'nova.tests.unit.test_profiler'
  38. [testenv:py27]
  39. commands =
  40. {[testenv]commands}
  41. stestr slowest
  42. [testenv:pep8]
  43. description =
  44. Run style checks.
  45. envdir = {toxworkdir}/shared
  46. commands =
  47. bash tools/flake8wrap.sh {posargs}
  48. # Check that all JSON files don't have \r\n in line.
  49. bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
  50. # Check that all included JSON files are valid JSON
  51. bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
  52. [testenv:fast8]
  53. description =
  54. Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8'
  55. envdir = {toxworkdir}/shared
  56. commands =
  57. bash tools/flake8wrap.sh -HEAD
  58. [testenv:functional]
  59. # TODO(melwitt): This can be removed when functional tests are gating with
  60. # python 3.x
  61. # NOTE(cdent): For a while, we shared functional virtualenvs with the unit
  62. # tests, to save some time. However, this conflicts with tox siblings in zuul,
  63. # and we need siblings to make testing against master of other projects work.
  64. basepython = python2.7
  65. setenv = {[testenv]setenv}
  66. # As nova functional tests import the PlacementFixture from the placement
  67. # repository these tests are, by default, set up to run with latest master from
  68. # the placement repo. In the gate, Zuul will clone the latest master from
  69. # placement OR the version of placement the Depends-On in the commit message
  70. # suggests. If you want to run the test locally with an un-merged placement
  71. # change, modify this line locally to point to your dependency or pip install
  72. # placement into the appropriate tox virtualenv. We express the requirement
  73. # here instead of test-requirements because we do not want placement present
  74. # during unit tests.
  75. deps =
  76. {[testenv]deps}
  77. git+https://opendev.org/openstack/placement#egg=openstack-placement
  78. commands =
  79. # NOTE(cdent): The group_regex describes how stestr will group tests into the
  80. # same process when running concurently. The following ensures that gabbi tests
  81. # coming from the same YAML file are all in the same process. This is important
  82. # because each YAML file represents an ordered sequence of HTTP requests. Note
  83. # that tests which do not match this regex will not be grouped in any
  84. # special way. See the following for more details.
  85. # http://stestr.readthedocs.io/en/latest/MANUAL.html#grouping-tests
  86. # https://gabbi.readthedocs.io/en/latest/#purpose
  87. stestr --test-path=./nova/tests/functional run {posargs}
  88. stestr slowest
  89. # TODO(gcb) Merge this into [testenv:functional] when functional tests are gating
  90. # with python 3
  91. [testenv:functional-py36]
  92. basepython = python3.6
  93. setenv = {[testenv]setenv}
  94. deps = {[testenv:functional]deps}
  95. commands =
  96. {[testenv:functional]commands}
  97. [testenv:functional-py37]
  98. basepython = python3.7
  99. setenv = {[testenv]setenv}
  100. deps = {[testenv:functional]deps}
  101. commands =
  102. {[testenv:functional]commands}
  103. [testenv:api-samples]
  104. setenv =
  105. {[testenv]setenv}
  106. GENERATE_SAMPLES=True
  107. PYTHONHASHSEED=0
  108. deps = {[testenv:functional]deps}
  109. commands =
  110. stestr --test-path=./nova/tests/functional/api_sample_tests run {posargs}
  111. stestr slowest
  112. [testenv:genconfig]
  113. envdir = {toxworkdir}/shared
  114. commands =
  115. oslo-config-generator --config-file=etc/nova/nova-config-generator.conf
  116. [testenv:genpolicy]
  117. envdir = {toxworkdir}/shared
  118. commands =
  119. oslopolicy-sample-generator --config-file=etc/nova/nova-policy-generator.conf
  120. [testenv:cover]
  121. # TODO(stephenfin): Remove the PYTHON hack below in favour of a [coverage]
  122. # section once we rely on coverage 4.3+
  123. #
  124. # https://bitbucket.org/ned/coveragepy/issues/519/
  125. envdir = {toxworkdir}/shared
  126. setenv =
  127. {[testenv]setenv}
  128. PYTHON=coverage run --source nova --parallel-mode
  129. commands =
  130. coverage erase
  131. stestr run {posargs}
  132. coverage combine
  133. coverage html -d cover
  134. coverage xml -o cover/coverage.xml
  135. coverage report
  136. [testenv:debug]
  137. envdir = {toxworkdir}/shared
  138. commands =
  139. oslo_debug_helper {posargs}
  140. [testenv:venv]
  141. deps =
  142. {[testenv]deps}
  143. -r{toxinidir}/doc/requirements.txt
  144. commands =
  145. {posargs}
  146. [testenv:docs]
  147. description =
  148. Build main documentation.
  149. deps =
  150. {[testenv]deps}
  151. -r{toxinidir}/doc/requirements.txt
  152. commands =
  153. rm -rf doc/build/html doc/build/doctrees
  154. # Check that all JSON files don't have \r\n in line.
  155. bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
  156. # Check that all included JSON files are valid JSON
  157. bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
  158. sphinx-build -W --keep-going -b html -d doc/build/doctrees doc/source doc/build/html
  159. # Test the redirects. This must run after the main docs build
  160. whereto doc/build/html/.htaccess doc/test/redirect-tests.txt
  161. [testenv:pdf-docs]
  162. description =
  163. Build PDF documentation.
  164. envdir = {toxworkdir}/docs
  165. deps = {[testenv:docs]deps}
  166. commands =
  167. rm -rf doc/build/pdf
  168. sphinx-build -W -b latex doc/source doc/build/pdf
  169. make -C doc/build/pdf
  170. [testenv:api-guide]
  171. description =
  172. Generate the API guide. Called from CI scripts to test and publish to docs.openstack.org.
  173. envdir = {toxworkdir}/docs
  174. deps = {[testenv:docs]deps}
  175. commands =
  176. rm -rf api-guide/build
  177. sphinx-build -W --keep-going -b html -d api-guide/build/doctrees api-guide/source api-guide/build/html
  178. [testenv:api-ref]
  179. description =
  180. Generate the API ref. Called from CI scripts to test and publish to docs.openstack.org.
  181. envdir = {toxworkdir}/docs
  182. deps = {[testenv:docs]deps}
  183. commands =
  184. rm -rf api-ref/build
  185. sphinx-build -W --keep-going -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
  186. [testenv:releasenotes]
  187. description =
  188. Generate release notes.
  189. envdir = {toxworkdir}/docs
  190. deps = {[testenv:docs]deps}
  191. commands =
  192. rm -rf releasenotes/build
  193. sphinx-build -W --keep-going -b html -d releasenotes/build/doctrees releasenotes/source releasenotes/build/html
  194. [testenv:all-docs]
  195. description =
  196. Build all documentation including API guides and refs.
  197. envdir = {toxworkdir}/docs
  198. deps = {[testenv:docs]deps}
  199. commands =
  200. {[testenv:docs]commands}
  201. {[testenv:api-guide]commands}
  202. {[testenv:api-ref]commands}
  203. {[testenv:releasenotes]commands}
  204. [testenv:bandit]
  205. # NOTE(browne): This is required for the integration test job of the bandit
  206. # project. Please do not remove.
  207. envdir = {toxworkdir}/shared
  208. commands = bandit -r nova -x tests -n 5 -ll
  209. [flake8]
  210. # E125 is deliberately excluded. See
  211. # https://github.com/jcrocholl/pep8/issues/126. It's just wrong.
  212. #
  213. # Most of the whitespace related rules (E12* and E131) are excluded
  214. # because while they are often useful guidelines, strict adherence to
  215. # them ends up causing some really odd code formatting and forced
  216. # extra line breaks. Updating code to enforce these will be a hard sell.
  217. #
  218. # H405 is another one that is good as a guideline, but sometimes
  219. # multiline doc strings just don't have a natural summary
  220. # line. Rejecting code for this reason is wrong.
  221. #
  222. # E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
  223. #
  224. # W504 skipped since you must choose either W503 or W504 (they conflict)
  225. #
  226. # E731 temporarily skipped because of the number of
  227. # these that have to be fixed
  228. enable-extensions = H106,H203,H904
  229. ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405,W504,E731
  230. exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,tools/xenserver*,releasenotes
  231. # To get a list of functions that are more complex than 25, set max-complexity
  232. # to 25 and run 'tox -epep8'.
  233. # 39 is currently the most complex thing we have
  234. # TODO(jogo): get this number down to 25 or so
  235. max-complexity=40
  236. [hacking]
  237. local-check-factory = nova.hacking.checks.factory
  238. import_exceptions = nova.i18n
  239. [testenv:bindep]
  240. # Do not install any requirements. We want this to be fast and work even if
  241. # system dependencies are missing, since it's used to tell you what system
  242. # dependencies are missing! This also means that bindep must be installed
  243. # separately, outside of the requirements files, and develop mode disabled
  244. # explicitly to avoid unnecessarily installing the checked-out repo too
  245. usedevelop = False
  246. deps = bindep
  247. commands =
  248. bindep test
  249. [testenv:lower-constraints]
  250. usedevelop = False
  251. deps =
  252. -c{toxinidir}/lower-constraints.txt
  253. -r{toxinidir}/test-requirements.txt
  254. -r{toxinidir}/requirements.txt