]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
hush pyflakes-0.4.0 warnings: slightly less-trivial fixes. Closes #900.
authorBrian Warner <warner@lothar.com>
Thu, 14 Jan 2010 22:17:19 +0000 (14:17 -0800)
committerBrian Warner <warner@lothar.com>
Thu, 14 Jan 2010 22:17:19 +0000 (14:17 -0800)
This includes one fix (in test_web) which was testing the wrong thing.

src/allmydata/test/no_network.py
src/allmydata/test/test_introducer.py
src/allmydata/test/test_node.py
src/allmydata/test/test_observer.py
src/allmydata/test/test_provisioning.py
src/allmydata/test/test_system.py
src/allmydata/test/test_uri.py
src/allmydata/test/test_util.py
src/allmydata/test/test_web.py

index 5e48e52e7a0131f7537ef118b48f8681eeecab2d..ab13bb923fc6fa120986491f7b35510553980059 100644 (file)
@@ -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):
index 9da6dccef45531c8d33c78581ce976fc65e1fde7..8da06d3a238ebdf601067e91fd789bbf0eb6ee6c 100644 (file)
@@ -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()
index fb6be27a03a0cae63e56ee5b72335c4cc63d5b0d..3fa72a0baa0344d7935da44bf97842001d1af92b 100644 (file)
@@ -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])
index c70810129477b561a9ec65c0b800e66efbb6b796..32fd0a395375a9f35639c1ccb558b6345bafd5e1 100644 (file)
@@ -12,6 +12,7 @@ class Observer(unittest.TestCase):
     def test_oneshot(self):
         ol = observer.OneShotObserverList()
         rep = repr(ol)
+        self.failUnlessEqual(rep, "<OneShotObserverList [[]]>")
         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, "<OneShotObserverList -> result>")
         d4 = ol.when_fired()
         dl = defer.DeferredList([d1,d2,d4])
         return dl
index 7e1f9a2f5771a03b35bfaf53b93983fbcb45f030..f22fe7ae66a6ac9aa404b89811674f0511af4d7e 100644 (file)
@@ -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
index 6b439a083bb36936b578806337539185036f61e1..60c705cb188340127dcab16a18f15e0fd65f107d 100644 (file)
@@ -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):
index 41d5927f93c94f4a90e6ce59c395574c4f0e3802..fe698e98f5f27dd769c9dd3411284ff45ad702fb 100644 (file)
@@ -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):
index f66d55f637d2bc898e8c8ef367b1f89b7132e92c..687465546ed7df95c0bd15256572320c16903938 100644 (file)
@@ -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
 
index 32765df68cb272b85a91ca09d7af23b46067f4ef..bb98652199c9d9f79b4b836780f112fd2800d4ca 100644 (file)
@@ -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]