From e3127cef290a981d108c17ff638acd5ae34430e5 Mon Sep 17 00:00:00 2001 From: Eyal Date: Mon, 26 Mar 2018 16:10:50 +0300 Subject: [PATCH] add python version number to db file this way we can run detox instead of tox and it will make tox run faster on our dev machines Change-Id: I9ff327edb1b1d0842ba14fe90784321c4ee27da0 --- tox.ini | 2 ++ .../entity_graph/graph_persistor/test_graph_persistor.py | 5 +++-- vitrage/tests/functional/test_configuration.py | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index ac2db6f10..f42cd3b4b 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,7 @@ skipsdist = True [testenv] usedevelop = True install_command = pip install -U -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} +whitelist_externals = find setenv = VIRTUAL_ENV={envdir} OS_TEST_PATH=vitrage/tests/unit @@ -15,6 +16,7 @@ commands = stestr run --serial '{posargs}' stestr slowest oslo-config-generator --config-file=etc/vitrage/vitrage-config-generator.conf + find . -type f -name "test-*.db" -delete passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY [testenv:pep8] diff --git a/vitrage/tests/functional/entity_graph/graph_persistor/test_graph_persistor.py b/vitrage/tests/functional/entity_graph/graph_persistor/test_graph_persistor.py index e54348c63..6d0edab7b 100644 --- a/vitrage/tests/functional/entity_graph/graph_persistor/test_graph_persistor.py +++ b/vitrage/tests/functional/entity_graph/graph_persistor/test_graph_persistor.py @@ -11,6 +11,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +import sys import time from oslo_config import cfg @@ -34,8 +35,8 @@ class TestGraphPersistor(TestFunctionalBase): cls.conf.register_opts(cls.PROCESSOR_OPTS, group='entity_graph') cls.conf.register_opts(cls.DATASOURCES_OPTS, group='datasources') cls.conf.register_opts(database_opts, group='database') - cls.conf.set_override('connection', 'sqlite:///test.db', - group='database') + cls.conf.set_override('connection', 'sqlite:///test-%s.db' + % sys.version_info[0], group='database') cls._db = storage.get_connection_from_config(cls.conf) engine = cls._db._engine_facade.get_engine() models.Base.metadata.create_all(engine) diff --git a/vitrage/tests/functional/test_configuration.py b/vitrage/tests/functional/test_configuration.py index decc1f926..c7b4c88d0 100644 --- a/vitrage/tests/functional/test_configuration.py +++ b/vitrage/tests/functional/test_configuration.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. import os +import sys import yaml from oslo_db.options import database_opts @@ -29,7 +30,8 @@ class TestConfiguration(object): @classmethod def add_db(cls, conf): conf.register_opts(database_opts, group='database') - db_name = "sqlite:///test_%s.db" % cls.__name__ + db_name = "sqlite:///test-%s-%s.db" % (cls.__name__, + sys.version_info[0]) conf.set_override('connection', db_name, group='database') cls._db = storage.get_connection_from_config(conf) engine = cls._db._engine_facade.get_engine()