diff --git a/.coveragerc b/.coveragerc index 4e0b29007..595e00616 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,7 +1,7 @@ [run] branch = True -source = monasca -omit = monasca/tests/* +source = monasca_api +omit = monasca_api/tests/* [report] ignore_errors = True diff --git a/.gitignore b/.gitignore index 957d4e2b7..693bd2a9f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ docs/build/* dist build -cover +cover* .coverage *.egg *.egg-info diff --git a/.testr.conf b/.testr.conf index 1414396c9..f875b61aa 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,8 +1,9 @@ [DEFAULT] test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - ${PYTHON:-python} -m subunit.run discover -t . ./monasca_api/tests $LISTOPT $IDOPTION + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \ + ${PYTHON:-python} -m subunit.run discover -t ./ $OS_TEST_PATH $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list +group_regex=monasca_api\.tests(?:\.|_)([^_]+) \ No newline at end of file diff --git a/test-requirements.txt b/test-requirements.txt index b953f6e45..fb15356f6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,18 +2,16 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. # Hacking already pins down pep8, pyflakes and flake8 -hacking<0.11,>=0.10.0 +hacking>=0.12.0,!=0.13.0,<0.14 # Apache-2.0 Babel>=2.3.4 # BSD coverage>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD -flake8<2.6.0,>=2.5.4 # MIT -pep8==1.5.7 # MIT httplib2>=0.7.5 # MIT mock>=2.0 # BSD funcsigs>=0.4;python_version=='2.7' or python_version=='2.6' # Apache-2.0 mox>=0.5.3 # Apache-2.0 -nose # LGPL oslotest>=1.10.0 # Apache-2.0 +os-testr>=0.8.0 # Apache-2.0 python-subunit>=0.0.18 # Apache-2.0/BSD testrepository>=0.0.18 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD diff --git a/tox.ini b/tox.ini index 391684c39..ae30d74ab 100644 --- a/tox.ini +++ b/tox.ini @@ -1,40 +1,75 @@ [tox] -minversion = 2.0 -skipsdist = True envlist = py27,pep8 +minversion = 2.1 +skipsdist = True [testenv] -setenv = VIRTUAL_ENV={envdir} +setenv = + VIRTUAL_ENV={envdir} + OS_TEST_PATH=monasca_api/tests + CLIENT_NAME=monasca-api +passenv = http_proxy + HTTP_PROXY + https_proxy + HTTPS_PROXY + no_proxy + NO_PROXY usedevelop = True install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -whitelist_externals = find +whitelist_externals = bash + find + rm commands = - pip install influxdb==2.8.0 - pip install cassandra-driver>=2.1.4,!=3.6.0 find . -type f -name "*.pyc" -delete - python setup.py testr --testr-args='{posargs}' + +[testenv:py27] +basepython = python2.7 +deps = {[testenv:unit_deps]deps} +commands = + {[testenv]commands} + ostestr {posargs} + +[testenv:py35] +basepython = python3.5 +deps = {[testenv:unit_deps]deps} +commands = + {[testenv]commands} + ostestr {posargs} [testenv:cover] -setenv = NOSE_WITH_COVERAGE=1 +basepython = python2.7 +deps = {[testenv:unit_deps]deps} commands = - python setup.py testr --coverage \ - --testr-args='^(?!.*test.*coverage).*$' + {[testenv]commands} + coverage erase + python setup.py test --coverage --testr-args='{posargs}' --coverage-package-name=monasca_api + coverage report + +[testenv:debug] +deps = {[testenv:unit_deps]deps} +commands = + {[testenv]commands} + oslo_debug_helper -t ./monasca_api/tests {posargs} [testenv:pep8] commands = flake8 monasca_api -[testenv:genconfig] - -[testenv:docs] -commands = python setup.py build_sphinx - [testenv:venv] commands = {posargs} +# note(trebskit): this is just placeholder to wrap all common dependencies +# needed to run tests, those dependencies won't likely +# be needed for every possible -e here, so extracted them here +[testenv:unit_deps] +deps = + {[testenv]deps} + influxdb==2.8.0 + cassandra-driver>=2.1.4,!=3.6.0 + [flake8] # TODO: ignored checks should be enabled in the future # H201 no 'except:' at least use 'except Exception:'