From cc70c163baa4669e9666c8891f6e2c8c23d1b3d1 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Fri, 2 Jan 2009 16:49:41 -0700 Subject: [PATCH] trivial: a few improvements to in-line doc and code, and renaming of test/test_immutable_checker.py to test/test_immutable.py That file currently tests checker and verifier and repairer, and will soon also test downloader. --- src/allmydata/immutable/download.py | 2 +- src/allmydata/storage.py | 3 +++ .../test/{test_immutable_checker.py => test_immutable.py} | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) rename src/allmydata/test/{test_immutable_checker.py => test_immutable.py} (99%) diff --git a/src/allmydata/immutable/download.py b/src/allmydata/immutable/download.py index daf9052c..cae5864b 100644 --- a/src/allmydata/immutable/download.py +++ b/src/allmydata/immutable/download.py @@ -802,7 +802,7 @@ class FileDownloader(log.PrefixingLogMixin): self._results.timings["peer_selection"] = now - self._started if len(self._share_buckets) < self._uri.needed_shares: - raise NotEnoughSharesError + raise NotEnoughSharesError(len(self._share_buckets), self._uri.needed_shares) #for s in self._share_vbuckets.values(): # for vb in s: diff --git a/src/allmydata/storage.py b/src/allmydata/storage.py index e89eb512..d6aef394 100644 --- a/src/allmydata/storage.py +++ b/src/allmydata/storage.py @@ -344,6 +344,9 @@ class BucketReader(Referenceable): self.storage_index = storage_index self.shnum = shnum + def __repr__(self): + return "<%s %s %s>" % (self.__class__.__name__, base32.b2a_l(self.storage_index[:8], 60), self.shnum) + def remote_read(self, offset, length): start = time.time() data = self._share_file.read_share_data(offset, length) diff --git a/src/allmydata/test/test_immutable_checker.py b/src/allmydata/test/test_immutable.py similarity index 99% rename from src/allmydata/test/test_immutable_checker.py rename to src/allmydata/test/test_immutable.py index a9b23616..5614a54a 100644 --- a/src/allmydata/test/test_immutable_checker.py +++ b/src/allmydata/test/test_immutable.py @@ -288,7 +288,7 @@ class Test(ShareManglingMixin, unittest.TestCase): # download it is more to test this test code than to test the Tahoe code... def _then_delete_8(unused=None): self.replace_shares(stash[0], storage_index=self.uri.storage_index) - for sharenum in range(2, 10): + for i in range(8): self._delete_a_share() d.addCallback(_then_delete_8) -- 2.45.2