From 0057aed72c6e92fbc7bfe27eb9a30f191eed3fd4 Mon Sep 17 00:00:00 2001 From: Stuart McLaren Date: Thu, 3 Oct 2013 11:24:35 +0000 Subject: [PATCH] Allow tests to run with both provenances of mox We currently have a requirement for mox >= 0.5.3. Confusingly there are two flavours of "mox 0.5.3" in the wild: 1) pypi's mox-0.5.3.tar.gz (https://pypi.python.org/pypi/mox) 2) Google's mox-0.5.3.tar.gz (https://code.google.com/p/pymox/) These are not exactly the same; tests which can pass on (1) may fail on (2). Fedora packages are based on (1) while Debian/Ubuntu packages are based on (2). This is a known issue: https://code.google.com/p/pymox/issues/detail?id=40 When running the tests using a virtual env (1) is used, but on Debian/Ubuntu when not running using a virtual env (2) will be used: this leads to 3 of the 1740 tests failing. This patch allows all 1743 tests to run whether you are running in a virtual env or using Debian/Ubuntu/Fedora packages. Fix for bug 1212625. Change-Id: Ib0b11ec18aafbfb7f3d243bf149b94f93a1c13c9 --- glance/tests/unit/test_store_image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glance/tests/unit/test_store_image.py b/glance/tests/unit/test_store_image.py index ad91d1aec3..f9f5d853cc 100644 --- a/glance/tests/unit/test_store_image.py +++ b/glance/tests/unit/test_store_image.py @@ -835,7 +835,7 @@ class TestStoreAddToBackend(utils.BaseTestCase): store = self.mox.CreateMockAnything() store.add(self.image_id, mox.IgnoreArg(), self.size).AndReturn( (self.location, self.size, self.checksum, in_metadata)) - store.__str__().AndReturn(('hello')) + store.__str__ = lambda: "hello" self.mox.ReplayAll() @@ -910,7 +910,7 @@ class TestStoreAddToBackend(utils.BaseTestCase): store = self.mox.CreateMockAnything() store.add(self.image_id, mox.IgnoreArg(), self.size).AndReturn( (self.location, self.size, self.checksum, [])) - store.__str__().AndReturn(('hello')) + store.__str__ = lambda: "hello" self.mox.ReplayAll()