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
This commit is contained in:
Eyal 2018-03-26 16:10:50 +03:00
parent ebe8a8a477
commit e3127cef29
3 changed files with 8 additions and 3 deletions

View File

@ -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]

View File

@ -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)

View File

@ -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()