From e8bca58887880b53ab61810a414ba8d5c5643c5c Mon Sep 17 00:00:00 2001 From: lijunbo Date: Sun, 14 Jan 2018 13:18:36 +0800 Subject: [PATCH] Use stestr for coverage Change [1] restored .testr.conf since it was needed for the manila coverage job. Modify script used by the coverage job to invoke stestr rather than setup.py with testr so that this job no longer requires .testr.conf so remove the dotfile and update .gitignore. TrivialFix [1] I451e383ed654d00a5a017cb28521c47566911f33 Change-Id: Ibf549220303395744380f79993fbfcf04b2ed5b7 Co-Authored-By: Tom Barron --- .gitignore | 1 - .testr.conf | 8 -------- test-requirements.txt | 1 - tools/cover.sh | 4 ++-- tox.ini | 6 +++++- 5 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 26e7d0d0bb..5bb4954b22 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ .manila-venv .coverage .stestr/* -.testrepository .tox .venv .idea diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 78b3824909..0000000000 --- a/.testr.conf +++ /dev/null @@ -1,8 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ./manila/tests $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/test-requirements.txt b/test-requirements.txt index fc135c89d6..ff15aa1d64 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -24,7 +24,6 @@ requests-mock>=1.1.0 # Apache-2.0 sphinx>=1.6.2 # BSD os-api-ref>=1.4.0 # Apache-2.0 os-testr>=1.0.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD testresources>=2.0.0 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT diff --git a/tools/cover.sh b/tools/cover.sh index 389884cf75..2279811643 100755 --- a/tools/cover.sh +++ b/tools/cover.sh @@ -29,7 +29,7 @@ uncommitted=$(git status --porcelain | grep -v "^??") git checkout HEAD^ baseline_report=$(mktemp -t manila_coverageXXXXXXX) -find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --testr-args="$TESTR_ARGS" +find . -type f -name "*.py[c|o]" -delete && stestr run "$TESTR_ARGS" && coverage combine && coverage html -d cover coverage report --ignore-errors > $baseline_report baseline_missing=$(awk 'END { print $3 }' $baseline_report) @@ -39,7 +39,7 @@ git checkout - # Generate and save coverage report current_report=$(mktemp -t manila_coverageXXXXXXX) -find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --testr-args="$TESTR_ARGS" +find . -type f -name "*.py[c|o]" -delete && stestr run "$TESTR_ARGS" && coverage combine && coverage html -d cover coverage report --ignore-errors > $current_report current_missing=$(awk 'END { print $3 }' $current_report) diff --git a/tox.ini b/tox.ini index bdf67a93d4..904aef10eb 100644 --- a/tox.ini +++ b/tox.ini @@ -72,7 +72,11 @@ commands = doc8 --ignore D001 --ignore-path .tox --ignore-path doc/build --ignore-path manila.egg-info -e txt -e rst [testenv:cover] -commands = {toxinidir}/tools/cover.sh {posargs} +setenv = + {[testenv]setenv} + PYTHON=coverage run --source manila --parallel-mode +commands = + {toxinidir}/tools/cover.sh {posargs} [testenv:fast8] commands =