Make FakeSwiftCall.DUMMY_VALUE a bespoke singleton
In test assertion failure messages the DUMMY_VALUE would be shown as <object object ...> which is not immediately recognisable as the dummy value.. This change makes the DUMMY_VALUE show as <test.unit.common.middleware.helpers.FakeSwiftDummyValue object ...>. Change-Id: I73fac245c65c48d45e4919c6f15688d482148407 Related-Change: I332ce724aa10287800cbec8ca21aacc3bbd3c22a
This commit is contained in:
1 changed files with 11 additions and 1 deletions
@@ -51,11 +51,21 @@ class LeakTrackingIter(object):
self.mark_closed(self.key)
class FakeSwiftDummyValue:
_instance = None
@classmethod
def singleton(cls):
if not cls._instance:
cls._instance = FakeSwiftDummyValue()
return cls._instance
class FakeSwiftCall(object):
"""
Encapsulate properties of a request captured by FakeSwift.
"""
DUMMY_VALUE = object()
DUMMY_VALUE = FakeSwiftDummyValue.singleton()
def __init__(self, req):
self.req = req
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.