From: Brian Warner Date: Thu, 14 Jan 2010 22:17:19 +0000 (-0800) Subject: hush pyflakes-0.4.0 warnings: slightly less-trivial fixes. Closes #900. X-Git-Url: https://git.rkrishnan.org/pf/vdrive?a=commitdiff_plain;h=e9223fcd0efd5a5c443c08f6325f1d7dc26f0126;p=tahoe-lafs%2Ftahoe-lafs.git hush pyflakes-0.4.0 warnings: slightly less-trivial fixes. Closes #900. This includes one fix (in test_web) which was testing the wrong thing. --- diff --git a/src/allmydata/test/no_network.py b/src/allmydata/test/no_network.py index 5e48e52e..ab13bb92 100644 --- a/src/allmydata/test/no_network.py +++ b/src/allmydata/test/no_network.py @@ -43,6 +43,7 @@ class LocalWrapper: def callRemoteOnly(self, methname, *args, **kwargs): d = self.callRemote(methname, *args, **kwargs) + del d # explicitly ignored return None def callRemote(self, methname, *args, **kwargs): diff --git a/src/allmydata/test/test_introducer.py b/src/allmydata/test/test_introducer.py index 9da6dcce..8da06d3a 100644 --- a/src/allmydata/test/test_introducer.py +++ b/src/allmydata/test/test_introducer.py @@ -48,6 +48,7 @@ class Introducer(ServiceMixin, unittest.TestCase, pollmixin.PollMixin): def test_create(self): ic = IntroducerClient(None, "introducer.furl", u"my_nickname", "my_version", "oldest_version") + self.failUnless(isinstance(ic, IntroducerClient)) def test_listen(self): i = IntroducerService() diff --git a/src/allmydata/test/test_node.py b/src/allmydata/test/test_node.py index fb6be27a..3fa72a0b 100644 --- a/src/allmydata/test/test_node.py +++ b/src/allmydata/test/test_node.py @@ -84,6 +84,7 @@ class TestCase(testutil.SignalMixin, unittest.TestCase): basedir = "test_node/test_secrets_dir" fileutil.make_dirs(basedir) n = TestNode(basedir) + self.failUnless(isinstance(n, TestNode)) self.failUnless(os.path.exists(os.path.join(basedir, "private"))) def test_secrets_dir_protected(self): @@ -95,6 +96,7 @@ class TestCase(testutil.SignalMixin, unittest.TestCase): basedir = "test_node/test_secrets_dir_protected" fileutil.make_dirs(basedir) n = TestNode(basedir) + self.failUnless(isinstance(n, TestNode)) privdir = os.path.join(basedir, "private") st = os.stat(privdir) bits = stat.S_IMODE(st[stat.ST_MODE]) diff --git a/src/allmydata/test/test_observer.py b/src/allmydata/test/test_observer.py index c7081012..32fd0a39 100644 --- a/src/allmydata/test/test_observer.py +++ b/src/allmydata/test/test_observer.py @@ -12,6 +12,7 @@ class Observer(unittest.TestCase): def test_oneshot(self): ol = observer.OneShotObserverList() rep = repr(ol) + self.failUnlessEqual(rep, "") d1 = ol.when_fired() d2 = ol.when_fired() def _addmore(res): @@ -22,6 +23,7 @@ class Observer(unittest.TestCase): d1.addCallback(_addmore) ol.fire("result") rep = repr(ol) + self.failUnlessEqual(rep, " result>") d4 = ol.when_fired() dl = defer.DeferredList([d1,d2,d4]) return dl diff --git a/src/allmydata/test/test_provisioning.py b/src/allmydata/test/test_provisioning.py index 7e1f9a2f..f22fe7ae 100644 --- a/src/allmydata/test/test_provisioning.py +++ b/src/allmydata/test/test_provisioning.py @@ -28,6 +28,7 @@ class Provisioning(unittest.TestCase): #ctx = RequestContext() #unfilled = pt.renderSynchronously(ctx) lots_of_stan = pt.do_forms(self.getarg) + self.failUnlessEqual(type(lots_of_stan), list) self.fields = {'filled': True, "num_users": 50e3, @@ -44,6 +45,7 @@ class Provisioning(unittest.TestCase): } #filled = pt.renderSynchronously(ctx) more_stan = pt.do_forms(self.getarg) + self.failUnlessEqual(type(more_stan), list) # trigger the wraparound configuration self.fields["num_servers"] = 5 diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 6b439a08..60c705cb 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -129,7 +129,7 @@ class SystemTest(SystemTestMixin, unittest.TestCase): log.msg("UPLOADING AGAIN") up = upload.Data(DATA, convergence=convergence) up.max_segment_size = 1024 - d1 = self.uploader.upload(up) + return self.uploader.upload(up) d.addCallback(_upload_again) def _download_to_data(res): diff --git a/src/allmydata/test/test_uri.py b/src/allmydata/test/test_uri.py index 41d5927f..fe698e98 100644 --- a/src/allmydata/test/test_uri.py +++ b/src/allmydata/test/test_uri.py @@ -1,7 +1,7 @@ from twisted.trial import unittest from allmydata import uri -from allmydata.util import hashutil +from allmydata.util import hashutil, base32 from allmydata.interfaces import IURI, IFileURI, IDirnodeURI, IMutableFileURI, \ IVerifierURI @@ -171,6 +171,13 @@ class Extension(unittest.TestCase): self.failUnlessEqual(d["big_hash"], hashutil.tagged_hash("foo", "bar")) readable = uri.unpack_extension_readable(ext) + self.failUnlessEqual(readable["needed_shares"], 3) + self.failUnlessEqual(readable["stuff"], "value") + self.failUnlessEqual(readable["size"], 12) + self.failUnlessEqual(readable["big_hash"], + base32.b2a(hashutil.tagged_hash("foo", "bar"))) + self.failUnlessEqual(readable["UEB_hash"], + base32.b2a(hashutil.uri_extension_hash(ext))) class Invalid(unittest.TestCase): def test_from_future(self): diff --git a/src/allmydata/test/test_util.py b/src/allmydata/test/test_util.py index f66d55f6..68746554 100644 --- a/src/allmydata/test/test_util.py +++ b/src/allmydata/test/test_util.py @@ -917,6 +917,7 @@ class CacheDir(unittest.TestCase): _failIfExists("a") _failUnlessExists("b") _failUnlessExists("c") + del b2 ctr = [0] class EqButNotIs: @@ -1491,6 +1492,8 @@ class Pipeline(unittest.TestCase): self.calls[1][0].callback("two-result") self.calls[2][0].errback(ValueError("three-error")) + del d1,d2,d3,d4 + class SampleError(Exception): pass diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 32765df6..bb986521 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -3375,8 +3375,8 @@ class Grid(GridTestMixin, WebErrorMixin, unittest.TestCase, ShouldFailMixin): if u["type"] == "file" and u["path"] == [u"good"]][0] self.failUnlessEqual(ugood["cap"], self.uris["good"]) ugoodcrr = ugood["check-and-repair-results"] - self.failUnlessEqual(u0crr["repair-attempted"], False) - self.failUnlessEqual(u0crr["pre-repair-results"]["results"]["count-shares-good"], 10) + self.failUnlessEqual(ugoodcrr["repair-attempted"], False) + self.failUnlessEqual(ugoodcrr["pre-repair-results"]["results"]["count-shares-good"], 10) usick = [u for u in units if u["type"] == "file" and u["path"] == [u"sick"]][0]