diff options
author | Felipe Reyes <freyes@suse.com> | 2014-07-18 14:03:02 +0200 |
---|---|---|
committer | Felipe Reyes <freyes@suse.com> | 2014-07-18 14:03:02 +0200 |
commit | 69c2c3f78bb779408f62c453a6af9cb8e60eccf5 (patch) | |
tree | 207444a08ac7b98e336b5470577bd444d79b67e9 | |
parent | 7d42c1075f5c566af371dbb74314b75496af6526 (diff) | |
download | oslo-incubator-69c2c3f78bb779408f62c453a6af9cb8e60eccf5.tar.gz |
Inherit MockWithCmp from Mock instead of MagicMock
This patch changes the base class for MockWithCmp and implements necessary
methods to compare instances, because mock.MagicMock in python 3 raises
NotImplemented exception on __lt__, __gt__, etc.
Change-Id: I56f774a5bc27726dae66acb70bf12bc618cb96fb
-rw-r--r-- | tests/unit/db/sqlalchemy/test_migrate_cli.py | 20 | ||||
-rw-r--r-- | tox.ini | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/unit/db/sqlalchemy/test_migrate_cli.py b/tests/unit/db/sqlalchemy/test_migrate_cli.py index 9e33bf5a..be6bcdd1 100644 --- a/tests/unit/db/sqlalchemy/test_migrate_cli.py +++ b/tests/unit/db/sqlalchemy/test_migrate_cli.py @@ -18,13 +18,31 @@ from openstack.common.db.sqlalchemy.migration_cli import ext_migrate from openstack.common.db.sqlalchemy.migration_cli import manager -class MockWithCmp(mock.MagicMock): +class MockWithCmp(mock.Mock): order = 0 def __cmp__(self, other): return self.order > other.order + def __lt__(self, other): + return self.order < other.order + + def __le__(self, other): + return self.order <= other.order + + def __eq__(self, other): + return self.order == other.order + + def __ge__(self, other): + return self.order >= other.order + + def __gt__(self, other): + return self.order > other.order + + def __ne__(self, other): + return self.order != other.order + @mock.patch(('openstack.common.db.sqlalchemy.migration_cli.' 'ext_alembic.alembic.command')) @@ -72,6 +72,7 @@ commands = tests.unit.cache.test_memory \ tests.unit.config.test_generator \ tests.unit.crypto.test_utils \ + tests.unit.db.sqlalchemy.test_migrate_cli \ tests.unit.db.sqlalchemy.test_models \ tests.unit.db.sqlalchemy.test_options \ tests.unit.db.test_api \ |