Merge "add python version number to db file"

This commit is contained in:
Zuul 2018-03-27 10:50:04 +00:00 committed by Gerrit Code Review
commit 2688bfb910
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()