From 29476ed0317dcc635dff67d2fc9fd68233aa6656 Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Tue, 7 Nov 2017 20:29:03 +0000 Subject: tox: Split tests into separate tox environments * Add argument parsing to run_tests.sh so tests can be selected * Define tox environments for: * Coverage * Unit tests * Functional tests * for py27 and py3 * Add environments to default env * Behaviour is the same when the tests are run * Updates the py27 environment config, and adds a py3 config. * Commands from testenv are moved to py27 * py3 env uses the same commands, but runs with python3 Change-Id: I22f17c0103101f01ec268b1de9d146780ae67a6d JIRA: YARDSTICK-837 Signed-off-by: Emma Foley --- run_tests.sh | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'run_tests.sh') 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 -- cgit 1.2.3-korg