Repair tests coverage utility

Add requirements for coverage utility.
It makes it possible to run `tox -e py27-cover`
and 'cover' directory will generated with
tests coverage report in HTML format.

Change-Id: I38c4197246fab4d0b8ea9ba3c61cc10966a1fc9e
This commit is contained in:
Vladislav Kuzmin 2015-03-10 16:20:31 +03:00
parent bc1c92505b
commit 7fb06e8317
5 changed files with 9 additions and 7 deletions

1
.gitignore vendored
View File

@ -7,4 +7,5 @@
AUTHORS AUTHORS
ChangeLog ChangeLog
build/ build/
cover/
dist dist

View File

@ -1,4 +1,4 @@
[DEFAULT] [DEFAULT]
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./refstack -s ./refstack/tests $LISTOPT $IDOPTION test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./refstack -s ${SUBUNIT_TEST_PATH:-./refstack/tests/unit} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE test_id_option=--load-list $IDFILE
test_list_option=--list test_list_option=--list

View File

@ -28,7 +28,6 @@ from sqlalchemy.schema import (
ForeignKeyConstraint, ForeignKeyConstraint,
DropConstraint, DropConstraint,
) )
from testtools import testcase
from refstack.db import migration from refstack.db import migration
@ -45,11 +44,11 @@ class FunctionalTest(base.BaseTestCase):
"""Test setup.""" """Test setup."""
super(FunctionalTest, self).setUp() super(FunctionalTest, self).setUp()
# Skip integration/functional tests
# if database has not been created
self.connection = os.environ.get("REFSTACK_TEST_MYSQL_URL") self.connection = os.environ.get("REFSTACK_TEST_MYSQL_URL")
if self.connection is None: if self.connection is None:
raise testcase.TestSkipped("Database connection url was not found") raise ValueError("Database connection url was not found. "
"Environment variable REFSTACK_TEST_MYSQL_URL "
"is not defined")
self.config = { self.config = {
'app': { 'app': {

View File

@ -1,3 +1,4 @@
coverage>=3.6
pep8==1.5.7 pep8==1.5.7
pyflakes==0.8.1 pyflakes==0.8.1
flake8==2.2.4 flake8==2.2.4

View File

@ -20,6 +20,7 @@ distribute = false
[testenv:py27-func-mysql] [testenv:py27-func-mysql]
basepython = python2.7 basepython = python2.7
setenv = SUBUNIT_TEST_PATH=./refstack/tests/api
# Integration/functional tests # Integration/functional tests
# must not be run in parallel (--concurrency=1), # must not be run in parallel (--concurrency=1),
# because each of these tests # because each of these tests
@ -42,8 +43,8 @@ commands =
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}
[testenv:cover] [testenv:py27-cover]
commands = python setup.py testr --coverage --testr-args='{posargs}' commands = python setup.py testr --coverage --omit='*/tests*' --testr-args='{posargs}'
[tox:jenkins] [tox:jenkins]
downloadcache = ~/cache/pip downloadcache = ~/cache/pip