Monasca REST API
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 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. [tox]
  2. envlist = py27,pep8,cover
  3. minversion = 2.7
  4. skipsdist = True
  5. [testenv]
  6. setenv =
  7. VIRTUAL_ENV={envdir}
  8. OS_TEST_PATH=monasca_api/tests
  9. passenv = *_proxy
  10. *_PROXY
  11. usedevelop = True
  12. install_command = pip install {opts} {packages}
  13. deps =
  14. -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
  15. -r{toxinidir}/test-requirements.txt
  16. -r{toxinidir}/requirements.txt
  17. .[influxdb,cassandra]
  18. whitelist_externals = bash
  19. find
  20. rm
  21. commands =
  22. find . -type f -name "*.pyc" -delete
  23. stestr run {posargs}
  24. [testenv:cover]
  25. basepython = python3
  26. commands =
  27. coverage erase
  28. python setup.py test --coverage --testr-args='{posargs}' \
  29. --coverage-package-name=monasca_api --omit=monasca_api/hacking/*
  30. coverage report
  31. [testenv:debug]
  32. basepython = python3
  33. commands =
  34. oslo_debug_helper -t ./monasca_api/tests {posargs}
  35. [testenv:flake8]
  36. basepython = python3
  37. skip_install = True
  38. usedevelop = False
  39. commands =
  40. flake8 monasca_api
  41. [testenv:bandit]
  42. basepython = python3
  43. skip_install = True
  44. usedevelop = False
  45. commands =
  46. # B101(assert_ussed) - API uses asserts because of performance reasons
  47. # B303 - Fingerprint class uses SHA1 to map fingerprints to alembic revisions.
  48. bandit -r monasca_api -n5 -s B101,B303 -x monasca_api/tests
  49. [testenv:bashate]
  50. basepython = python3
  51. skip_install = True
  52. usedevelop = False
  53. commands = bash {toxinidir}/tools/bashate.sh
  54. [testenv:pep8]
  55. basepython = python3
  56. commands =
  57. {[testenv:flake8]commands}
  58. {[testenv:bandit]commands}
  59. {[testenv:bashate]commands}
  60. {[testenv:checkniceness]commands}
  61. [testenv:docs]
  62. basepython = python3
  63. description = Builds api-ref, api-guide, releasenotes and devdocs
  64. commands =
  65. {[testenv:devdocs]commands}
  66. {[testenv:api-ref]commands}
  67. {[testenv:releasenotes]commands}
  68. [testenv:api-ref]
  69. basepython = python3
  70. description = Called from CI scripts to test and publish the API Ref
  71. commands =
  72. rm -rf api-ref/build
  73. {[testenv:checkjson]commands}
  74. sphinx-build -W -b html -d api-ref/build/doctrees \
  75. api-ref/source api-ref/build/html
  76. [testenv:releasenotes]
  77. basepython = python3
  78. description = Called from CI script to test and publish the Release Notes
  79. commands =
  80. rm -rf releasenotes/build
  81. sphinx-build -a -E -W -d releasenotes/build/doctrees -b html \
  82. releasenotes/source releasenotes/build/html
  83. [testenv:devdocs]
  84. basepython = python3
  85. description = Builds developer documentation
  86. commands =
  87. rm -rf doc/build doc/source/contributor/api
  88. {[testenv:checkjson]commands}
  89. python setup.py build_sphinx
  90. [testenv:checkniceness]
  91. basepython = python3
  92. skip_install = True
  93. usedevelop = False
  94. description = Validates (pep-like) documenation
  95. commands =
  96. rm -rf {toxinidir}/doc/source/contributor/api {toxinidir}/doc/build \
  97. {toxinidir}/api-ref/build {toxinidir}/releasenotes/build
  98. doc8 --file-encoding utf-8 {toxinidir}/doc
  99. doc8 --file-encoding utf-8 {toxinidir}/api-ref
  100. doc8 --file-encoding utf-8 {toxinidir}/releasenotes
  101. [testenv:checkjson]
  102. basepython = python3
  103. description = Validates all json samples inside doc folder
  104. deps =
  105. skip_install = True
  106. usedevelop = False
  107. whitelist_externals =
  108. python
  109. bash
  110. commands =
  111. bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
  112. bash -c '! find doc/ -type f -name *.json | \
  113. xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
  114. [testenv:genconfig]
  115. basepython = python3
  116. description = Generates sample configuration file for monasca-api
  117. commands = oslo-config-generator --config-file=config-generator/monasca-api.conf
  118. [testenv:genpolicy]
  119. basepython = python3
  120. description = Generates sample policy.json file for monasca-api
  121. commands = oslopolicy-sample-generator --config-file=config-generator/policy.conf
  122. [testenv:venv]
  123. basepython = python3
  124. commands = {posargs}
  125. [testenv:bindep]
  126. basepython = python3
  127. deps = bindep
  128. commands = bindep test
  129. [flake8]
  130. # TODO: ignored checks should be enabled in the future
  131. # H201 no 'except:' at least use 'except Exception:'
  132. # H302 import only modules
  133. # H405 multi line docstring summary not separated with an empty line
  134. ignore = F821,H201,H302,H405
  135. # H106: Don't put vim configuration in source files
  136. # H203: Use assertIs(Not)None to check for None
  137. # H204: Use assert(Not)Equal to check for equality.
  138. # H205: Use assert(Greater|Less)(Equal) for comparison.
  139. enable-extensions=H106,H203,H204,H205
  140. max-complexity = 50
  141. max-line-length = 100
  142. builtins = _
  143. exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,build
  144. show-source = True
  145. [hacking]
  146. local-check-factory = monasca_api.hacking.checks.factory
  147. import_exceptions =
  148. six.moves
  149. [testenv:lower-constraints]
  150. basepython = python3
  151. deps =
  152. -c{toxinidir}/lower-constraints.txt
  153. -r{toxinidir}/test-requirements.txt
  154. -r{toxinidir}/requirements.txt
  155. .[influxdb,cassandra]