From 465b10e1ef3193bffca09a263690423e1a599abe Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Fri, 29 Jun 2018 14:53:30 +0200 Subject: [PATCH] Fix the coverage tox target It was broken for a long while, since the migration of the dashboard code into Horizon, and then back into this repository, as .testr.conf was removed. Use coverage directly instead of testrepository, the same way as Horizon does. We should port the normal test runner to the Django test runner too, instead of the custom run_tests.sh script, but that's for another (future) review. Change-Id: I08966ddc7e891156a1c934bb115ce8a02f77ec83 --- .coveragerc | 13 +++++++++++++ lower-constraints.txt | 1 - test-requirements.txt | 1 - tox.ini | 6 +++++- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..f7d9544f --- /dev/null +++ b/.coveragerc @@ -0,0 +1,13 @@ +[run] +branch = True +source = sahara_dashboard +omit = + .tox/* + sahara_dashboard/test/* + +[paths] +source = sahara_dashboard + +[report] +ignore_errors = True +precision = 3 diff --git a/lower-constraints.txt b/lower-constraints.txt index 786311e2..65780c19 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -112,7 +112,6 @@ six==1.10.0 statsd==3.2.1 stevedore==1.20.0 tenacity==3.2.1 -testrepository==0.0.18 testscenarios==0.4 testtools==2.2.0 traceback2==1.4.0 diff --git a/test-requirements.txt b/test-requirements.txt index bd1bbc52..a765df6f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,7 +12,6 @@ netifaces>=0.10.4 # MIT nose-exclude>=0.5.0 # LGPL python-subunit>=1.0.0 # Apache-2.0/BSD selenium>=2.50.1 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT # This also needs xvfb library installed on your OS diff --git a/tox.ini b/tox.ini index d2c038be..c9263d71 100644 --- a/tox.ini +++ b/tox.ini @@ -54,7 +54,11 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen [testenv:cover] basepython = python3 -commands = python setup.py testr --coverage --testr-args='{posargs}' +commands = + coverage erase + coverage run {toxinidir}/manage.py test sahara_dashboard --settings=sahara_dashboard.test.settings --exclude-dir=sahara_dashboard/test/integration_tests {posargs} + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:debug] basepython = python3