From 467a0418c875ac114eac78de4560616953cd45ad Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 19 May 2016 15:16:54 +0200 Subject: [PATCH] Replace overtest by pifpaf This is new and shiny! Change-Id: I5ccc576211a0c49b65a07cc4054a2d039bd4d5d5 --- aodh/tests/functional/db.py | 5 ++--- aodh/tests/functional/gabbi/fixtures.py | 14 +++++++------- run-functional-tests.sh | 6 ++---- setup.cfg | 2 +- tox.ini | 16 ++++++++-------- 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/aodh/tests/functional/db.py b/aodh/tests/functional/db.py index 5df1f8bd..cd257d6d 100644 --- a/aodh/tests/functional/db.py +++ b/aodh/tests/functional/db.py @@ -132,9 +132,8 @@ class TestBase(test_base.BaseTestCase): super(TestBase, self).setUp() db_url = os.environ.get( 'AODH_TEST_STORAGE_URL', - os.environ.get( - "OVERTEST_URL", 'sqlite://').replace( - "mysql://", "mysql+pymysql://")) + 'sqlite://').replace( + "mysql://", "mysql+pymysql://") engine = urlparse.urlparse(db_url).scheme # In case some drivers have additional specification, for example: # PyMySQL will have scheme mysql+pymysql. diff --git a/aodh/tests/functional/gabbi/fixtures.py b/aodh/tests/functional/gabbi/fixtures.py index cbc5bb8e..45dd1f14 100644 --- a/aodh/tests/functional/gabbi/fixtures.py +++ b/aodh/tests/functional/gabbi/fixtures.py @@ -42,10 +42,8 @@ class ConfigFixture(fixture.GabbiFixture): # Determine the database connection. db_url = os.environ.get( - 'AODH_TEST_STORAGE_URL', - os.environ.get( - "OVERTEST_URL", 'sqlite://').replace( - "mysql://", "mysql+pymysql://")) + 'AODH_TEST_STORAGE_URL', "").replace( + "mysql://", "mysql+pymysql://") if not db_url: raise case.SkipTest('No database connection configured') @@ -78,9 +76,11 @@ class ConfigFixture(fixture.GabbiFixture): conf.set_override('pecan_debug', True, group='api', enforce_type=True) - parsed_url = list(urlparse.urlparse(db_url)) - parsed_url[2] += '-%s' % str(uuid.uuid4()).replace('-', '') - db_url = urlparse.urlunparse(parsed_url) + parsed_url = urlparse.urlparse(db_url) + if parsed_url.scheme != 'sqlite': + parsed_url = list(parsed_url) + parsed_url[2] += '-%s' % str(uuid.uuid4()).replace('-', '') + db_url = urlparse.urlunparse(parsed_url) conf.set_override('connection', db_url, group='database', enforce_type=True) diff --git a/run-functional-tests.sh b/run-functional-tests.sh index 859a04ba..9f9af8df 100755 --- a/run-functional-tests.sh +++ b/run-functional-tests.sh @@ -6,11 +6,9 @@ export AODH_SERVICE_URL=${AODH_SERVICE_URL:-http://127.0.0.1:8042} case $AODH_TEST_BACKEND in hbase) - export AODH_TEST_STORAGE_URL="hbase://__test__" + AODH_TEST_STORAGE_URL="hbase://__test__" $* ;; *) - source $(which overtest) $AODH_TEST_BACKEND + pifpaf -g AODH_TEST_STORAGE_URL run $AODH_TEST_BACKEND -- $* ;; esac - -$* diff --git a/setup.cfg b/setup.cfg index 760fc2ba..7c3a61eb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,7 +58,7 @@ doc = sphinxcontrib-pecanwsme>=0.8 test = - overtest>=0.7.0 + pifpaf>=0.1.0 oslotest>=1.5.1 # Apache-2.0 coverage>=3.6 fixtures>=1.3.1 diff --git a/tox.ini b/tox.ini index 6e9e6c73..0ade3a6e 100644 --- a/tox.ini +++ b/tox.ini @@ -24,19 +24,19 @@ setenv = OS_TEST_PATH=aodh/tests/functional/ deps = .[mongodb,test] setenv = OS_TEST_PATH=aodh/tests/functional/ commands = - overtest mongodb python setup.py testr --slowest --testr-args="{posargs}" + pifpaf -g AODH_TEST_STORAGE_URL run mongodb -- python setup.py testr --slowest --testr-args="{posargs}" [testenv:py27-mysql] deps = .[mysql,test] setenv = OS_TEST_PATH=aodh/tests/functional/ commands = - overtest mysql python setup.py testr --slowest --testr-args="{posargs}" + pifpaf -g AODH_TEST_STORAGE_URL run mysql -- python setup.py testr --slowest --testr-args="{posargs}" [testenv:py27-pgsql] deps = .[postgresql,test] setenv = OS_TEST_PATH=aodh/tests/functional/ commands = - overtest postgresql python setup.py testr --slowest --testr-args="{posargs}" + pifpaf -g AODH_TEST_STORAGE_URL run postgresql -- python setup.py testr --slowest --testr-args="{posargs}" [testenv:functional] deps = .[mysql,postgresql,mongodb,hbase,test] @@ -55,10 +55,10 @@ commands = deps = .[mysql,test] setenv = OS_TEST_PATH=aodh/tests/functional/gabbi commands = - overtest mysql python setup.py testr --testr-args="{posargs}" + pifpaf -g AODH_TEST_STORAGE_URL run mysql -- python setup.py testr --testr-args="{posargs}" [testenv:cover] -commands = overtest mysql python setup.py testr --slowest --coverage --testr-args="{posargs}" +commands = pifpaf -g AODH_TEST_STORAGE_URL run mysql -- python setup.py testr --slowest --coverage --testr-args="{posargs}" [testenv:pep8] deps = hacking<0.12,>=0.11.0 @@ -90,17 +90,17 @@ commands = bash -x oslo_debug_helper {posargs} [testenv:debug-mongodb] deps = .[mongodb,test] setenv = OS_TEST_PATH=aodh/tests/functional/ -commands = overtest mongodb oslo_debug_helper {posargs} +commands = pifpaf -g AODH_TEST_STORAGE_URL run mongodb -- oslo_debug_helper {posargs} [testenv:debug-mysql] deps = .[mysql,test] setenv = OS_TEST_PATH=aodh/tests/functional/ -commands = overtest mysql oslo_debug_helper {posargs} +commands = pifpaf -g AODH_TEST_STORAGE_URL run mysql -- oslo_debug_helper {posargs} [testenv:debug-pgsql] deps = .[postgresql,test] setenv = OS_TEST_PATH=aodh/tests/functional/ -commands = overtest postgresql oslo_debug_helper {posargs} +commands = pifpaf -g AODH_TEST_STORAGE_URL run postgresql -- oslo_debug_helper {posargs} [flake8] ignore =