Use successResultOf in renderSynchronously

Get rid of [].append trick when dealing with the deferred.
This commit is contained in:
Sajith Sasidharan 2020-02-13 17:00:54 -05:00
parent e2fc1fc07e
commit c061f6830e

View File

@ -2969,9 +2969,8 @@ def renderSynchronously(ss):
:param _StorageStatus ss: a StorageStatus instance. :param _StorageStatus ss: a StorageStatus instance.
""" """
elem = StorageStatusElement(ss.storage, ss.nickname) elem = StorageStatusElement(ss.storage, ss.nickname)
result = [] deferred = flattenString(None, elem)
flattenString(None, elem).addCallback(result.append) return unittest.TestCase().successResultOf(deferred)
return result[0]
class MyBucketCountingCrawler(BucketCountingCrawler): class MyBucketCountingCrawler(BucketCountingCrawler):
def finished_prefix(self, cycle, prefix): def finished_prefix(self, cycle, prefix):