aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-11-29 11:50:07 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-11-29 11:50:07 +0000
commit3cc9280fe7f341b60d4a2384d7fa6e33d575a7a2 (patch)
tree8cc94208f579673d24bdf159b0d9c85733be3297
parent449679aeee27e08d5e47a7d5d76857b4827e263e (diff)
parent29476ed0317dcc635dff67d2fc9fd68233aa6656 (diff)
Merge "tox: Split tests into separate tox environments"
-rwxr-xr-xrun_tests.sh29
-rw-r--r--tox.ini25
2 files changed, 40 insertions, 14 deletions
diff --git a/run_tests.sh b/run_tests.sh
index 097935890..dda760218 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -9,9 +9,10 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-# Run yardstick's flake8, unit, coverage, functional test
+# Run yardstick's unit, coverage, functional test
getopts ":f" FILE_OPTION
+opts=$@ # get other args
# don't write .pyc files this can cause odd unittest results
export PYTHONDONTWRITEBYTECODE=1
@@ -45,11 +46,8 @@ run_tests() {
}
run_coverage() {
- # don't re-run coverage on both py27 py3, it takes too long
- if [[ -z $SKIP_COVERAGE ]] ; then
- source $COVER_DIR_NAME/cover.sh
- run_coverage_test
- fi
+ source $COVER_DIR_NAME/cover.sh
+ run_coverage_test
}
run_functional_test() {
@@ -68,7 +66,20 @@ run_functional_test() {
fi
}
+if [[ $opts =~ "--unit" ]]; then
+ run_tests
+fi
+
+if [[ $opts =~ "--coverage" ]]; then
+ run_coverage
+fi
+
+if [[ $opts =~ "--functional" ]]; then
+ run_functional_test
+fi
-run_tests
-run_coverage
-run_functional_test
+if [[ -z $opts ]]; then
+ echo "No tests to run!!"
+ echo "Usage: run_tests.sh [--unit] [--coverage] [--functional]"
+ exit 1
+fi
diff --git a/tox.ini b/tox.ini
index 882543d0c..ed2fd4a7d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,7 +1,7 @@
[tox]
minversion = 2.0
skipsdist = True
-envlist = py27,py3,pep8
+envlist = py{27,3},pep8,functional{,-py3},coverage
[testenv]
usedevelop=True
@@ -9,13 +9,15 @@ passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-commands = /bin/bash ./run_tests.sh
whitelist_externals = /bin/bash
[testenv:py27]
-# don't re-run coverage on both py27 py3, it takes too long
-setenv =
- SKIP_COVERAGE=1
+commands =
+ /bin/bash ./run_tests.sh --unit
+
+[testenv:py3]
+basepython = python3
+commands = {[testenv:py27]commands}
[testenv:pep8]
# for gate testing, scans only the files changed in the last commit
@@ -27,6 +29,19 @@ commands =
commands =
/bin/bash tools/coding-checks.sh --pylint '{posargs}'
+[testenv:coverage]
+basepython = python3
+commands =
+ /bin/bash ./run_tests.sh --coverage
+
+[testenv:functional]
+commands =
+ /bin/bash ./run_tests.sh --functional
+
+[testenv:functional-py3]
+basepython = python3
+commands = {[testenv:functional]commands}
+
[testenv:os-requirements]
commands =
python {toxinidir}/tools/os-requirements-check.py {envdir}