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:
rabi 2022-06-27 21:50:45 +05:30
parent c37ea72a6b
commit 38238b88f7
2 changed files with 11 additions and 7 deletions

View File

@ -220,15 +220,19 @@ class JsonRepr(object):
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):
new_context = db_api.db_context.make_new_manager()
new_context.configure(sqlite_fk=self.enable_fkc)
if self.engine.name == 'sqlite':
self.engine.execute("PRAGMA foreign_keys=ON")
self.useFixture(fixtures.MockPatchObject(db_api, '_facade', None))
self.addCleanup(db_api.db_context.patch_factory(new_context._factory))
def disable_fks():
with self.engine.connect() as conn:
conn.connection.rollback()
conn.execute("PRAGMA foreign_keys=OFF")
self.addCleanup(disable_fks)
class AnyInstance(object):

View File

@ -9,7 +9,6 @@ basepython = python3
setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
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
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
@ -59,6 +58,7 @@ allowlist_externals =
rm
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build