diff --git a/.gitignore b/.gitignore index 9ebef97f..88e7ec67 100755 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ AUTHORS ChangeLog build/ +cover/ dist diff --git a/.testr.conf b/.testr.conf index bd99ad88..ec31a08b 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,4 +1,4 @@ [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_list_option=--list diff --git a/refstack/tests/api/__init__.py b/refstack/tests/api/__init__.py index 10552f17..f4c189e7 100644 --- a/refstack/tests/api/__init__.py +++ b/refstack/tests/api/__init__.py @@ -28,7 +28,6 @@ from sqlalchemy.schema import ( ForeignKeyConstraint, DropConstraint, ) -from testtools import testcase from refstack.db import migration @@ -45,11 +44,11 @@ class FunctionalTest(base.BaseTestCase): """Test setup.""" super(FunctionalTest, self).setUp() - # Skip integration/functional tests - # if database has not been created self.connection = os.environ.get("REFSTACK_TEST_MYSQL_URL") 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 = { 'app': { diff --git a/test-requirements.txt b/test-requirements.txt index 3106314a..443e1a73 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,4 @@ +coverage>=3.6 pep8==1.5.7 pyflakes==0.8.1 flake8==2.2.4 diff --git a/tox.ini b/tox.ini index 3e37dbf5..358b9fbf 100644 --- a/tox.ini +++ b/tox.ini @@ -20,6 +20,7 @@ distribute = false [testenv:py27-func-mysql] basepython = python2.7 +setenv = SUBUNIT_TEST_PATH=./refstack/tests/api # Integration/functional tests # must not be run in parallel (--concurrency=1), # because each of these tests @@ -42,8 +43,8 @@ commands = [testenv:venv] commands = {posargs} -[testenv:cover] -commands = python setup.py testr --coverage --testr-args='{posargs}' +[testenv:py27-cover] +commands = python setup.py testr --coverage --omit='*/tests*' --testr-args='{posargs}' [tox:jenkins] downloadcache = ~/cache/pip