Fix tests for fixtures 4.0.0
This fixes ForeignKeyConstraintFixture for the db tests. Also drops install_command from tox.ini. Change-Id: I3d0abf68cae89566f4d346cd16919a6050168130
This commit is contained in:
parent
c37ea72a6b
commit
38238b88f7
@ -220,15 +220,19 @@ class JsonRepr(object):
|
|||||||
|
|
||||||
|
|
||||||
class ForeignKeyConstraintFixture(fixtures.Fixture):
|
class ForeignKeyConstraintFixture(fixtures.Fixture):
|
||||||
def __init__(self, sqlite_fk=True):
|
|
||||||
self.enable_fkc = sqlite_fk
|
def __init__(self):
|
||||||
|
self.engine = get_engine()
|
||||||
|
|
||||||
def _setUp(self):
|
def _setUp(self):
|
||||||
new_context = db_api.db_context.make_new_manager()
|
if self.engine.name == 'sqlite':
|
||||||
new_context.configure(sqlite_fk=self.enable_fkc)
|
self.engine.execute("PRAGMA foreign_keys=ON")
|
||||||
|
|
||||||
self.useFixture(fixtures.MockPatchObject(db_api, '_facade', None))
|
def disable_fks():
|
||||||
self.addCleanup(db_api.db_context.patch_factory(new_context._factory))
|
with self.engine.connect() as conn:
|
||||||
|
conn.connection.rollback()
|
||||||
|
conn.execute("PRAGMA foreign_keys=OFF")
|
||||||
|
self.addCleanup(disable_fks)
|
||||||
|
|
||||||
|
|
||||||
class AnyInstance(object):
|
class AnyInstance(object):
|
||||||
|
2
tox.ini
2
tox.ini
@ -9,7 +9,6 @@ basepython = python3
|
|||||||
setenv = VIRTUAL_ENV={envdir}
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
PYTHONWARNINGS=default::DeprecationWarning
|
PYTHONWARNINGS=default::DeprecationWarning
|
||||||
OS_TEST_PATH=heat/tests
|
OS_TEST_PATH=heat/tests
|
||||||
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
|
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
@ -59,6 +58,7 @@ allowlist_externals =
|
|||||||
rm
|
rm
|
||||||
deps =
|
deps =
|
||||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||||
|
-r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/doc/requirements.txt
|
-r{toxinidir}/doc/requirements.txt
|
||||||
commands =
|
commands =
|
||||||
rm -rf doc/build
|
rm -rf doc/build
|
||||||
|
Loading…
Reference in New Issue
Block a user