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.
This commit is contained in:
Brian Warner 2010-01-14 14:17:19 -08:00
parent 731d15e56f
commit e9223fcd0e
9 changed files with 22 additions and 4 deletions

View 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):

View 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()

View 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])

View 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

View 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

View 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):

View 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):

View 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

View 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]