summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrabi <ramishra@redhat.com>2022-06-27 21:50:45 +0530
committerrabi <ramishra@redhat.com>2022-06-27 22:41:52 +0530
commit38238b88f74983534215bd4c0afdfd67fdbeaaa4 (patch)
treea004906547d07f5e161e91cded64ebf52ba3e6e7
parentc37ea72a6b2c424136ed2ee2cd378928021da78e (diff)
downloadheat-38238b88f74983534215bd4c0afdfd67fdbeaaa4.tar.gz
Fix tests for fixtures 4.0.0
This fixes ForeignKeyConstraintFixture for the db tests. Also drops install_command from tox.ini. Change-Id: I3d0abf68cae89566f4d346cd16919a6050168130
-rw-r--r--heat/tests/utils.py18
-rw-r--r--tox.ini2
2 files changed, 12 insertions, 8 deletions
diff --git a/heat/tests/utils.py b/heat/tests/utils.py
index cf3e383f8..19fc1a06f 100644
--- a/heat/tests/utils.py
+++ b/heat/tests/utils.py
@@ -220,15 +220,19 @@ class JsonRepr(object):
class ForeignKeyConstraintFixture(fixtures.Fixture):
- def __init__(self, sqlite_fk=True):
- self.enable_fkc = sqlite_fk
- def _setUp(self):
- new_context = db_api.db_context.make_new_manager()
- new_context.configure(sqlite_fk=self.enable_fkc)
+ def __init__(self):
+ self.engine = get_engine()
- self.useFixture(fixtures.MockPatchObject(db_api, '_facade', None))
- self.addCleanup(db_api.db_context.patch_factory(new_context._factory))
+ def _setUp(self):
+ if self.engine.name == 'sqlite':
+ self.engine.execute("PRAGMA foreign_keys=ON")
+
+ 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):
diff --git a/tox.ini b/tox.ini
index 10fc10606..662ebcac7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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