From 3112eaff043608bf9458524ca9beb730b76733b3 Mon Sep 17 00:00:00 2001 From: Roman Podoliaka Date: Wed, 25 Feb 2015 15:09:27 +0200 Subject: [PATCH] Fix the order of base classes in DB test cases Next release of oslo.db is going to break Tuskar DB tests: when a test case cleanup is run, it fails to fetch 'schema' attribute of oslo.db base test case, set in its setup. The problem is that Tuskar base test case intentionally removes all attributes from a test case class instance in its cleanup callback (to ensure there are no memory leaks). So in order for Tuskar unit tests to work correctly with new release of oslo.db we need either to remove inheritance from Tuskar base test case or to change the order of base classes to achieve the 'proper' MRO for DB test cases. In future, oslo.db is going to introduce a DB fixture instead of a base test case class to avoid such problems with multiple inheritance. Change-Id: Ia0ca1b261d707b6fbe349fd536599c845da0a2e9 --- .../tests/storage/drivers/test_sqlalchemy.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tuskar/tests/storage/drivers/test_sqlalchemy.py b/tuskar/tests/storage/drivers/test_sqlalchemy.py index 815a78e1..9d0da0b6 100644 --- a/tuskar/tests/storage/drivers/test_sqlalchemy.py +++ b/tuskar/tests/storage/drivers/test_sqlalchemy.py @@ -37,32 +37,32 @@ class VersionStoreSQLAlchemyTestCase(SQLAlchemyTestCase, pass -class MySQLBaseStoreTestCase(BaseStoreSQLAlchemyTestCase, - test_base.MySQLOpportunisticTestCase): +class MySQLBaseStoreTestCase(test_base.MySQLOpportunisticTestCase, + BaseStoreSQLAlchemyTestCase): pass -class MySQLNamedStoreTestCase(NamedStoreSQLAlchemyTestCase, - test_base.MySQLOpportunisticTestCase): +class MySQLNamedStoreTestCase(test_base.MySQLOpportunisticTestCase, + NamedStoreSQLAlchemyTestCase): pass -class MySQLVersionedStoreTestCase(VersionStoreSQLAlchemyTestCase, - test_base.MySQLOpportunisticTestCase): +class MySQLVersionedStoreTestCase(test_base.MySQLOpportunisticTestCase, + VersionStoreSQLAlchemyTestCase): pass -class PostgreSQLBaseStoreTestCase(BaseStoreSQLAlchemyTestCase, - test_base.PostgreSQLOpportunisticTestCase): +class PostgreSQLBaseStoreTestCase(test_base.PostgreSQLOpportunisticTestCase, + BaseStoreSQLAlchemyTestCase): pass -class PostgreSQLNamedStoreTestCase(NamedStoreSQLAlchemyTestCase, - test_base.PostgreSQLOpportunisticTestCase): +class PostgreSQLNamedStoreTestCase(test_base.PostgreSQLOpportunisticTestCase, + NamedStoreSQLAlchemyTestCase): pass class PostgreSQLVersionedStoreTestCase( - VersionStoreSQLAlchemyTestCase, - test_base.PostgreSQLOpportunisticTestCase): + test_base.PostgreSQLOpportunisticTestCase, + VersionStoreSQLAlchemyTestCase): pass