From: Zooko O'Whielacronx Date: Fri, 4 Jun 2010 07:58:45 +0000 (-0700) Subject: fix flakes X-Git-Url: https://git.rkrishnan.org/maximilian?a=commitdiff_plain;h=952f3bf3ef0935c3f89880c7731dfaf3d1df6ff2;p=tahoe-lafs%2Ftahoe-lafs.git fix flakes --- diff --git a/src/allmydata/scripts/common.py b/src/allmydata/scripts/common.py index 6f82b7b4..38937133 100644 --- a/src/allmydata/scripts/common.py +++ b/src/allmydata/scripts/common.py @@ -41,7 +41,6 @@ class BasedirMixin: self['basedirs'] = [os.path.abspath(os.path.expanduser(b)) for b in self.basedirs] def parseArgs(self, *args): - from allmydata.util.assertutil import precondition self.basedirs = [] if self['basedir']: precondition(isinstance(self['basedir'], (str, unicode)), self['basedir']) @@ -68,7 +67,6 @@ class BasedirMixin: class NoDefaultBasedirMixin(BasedirMixin): def parseArgs(self, *args): - from allmydata.util.assertutil import precondition # create-client won't default to --basedir=~/.tahoe self.basedirs = [] if self['basedir']: diff --git a/src/allmydata/scripts/tahoe_add_alias.py b/src/allmydata/scripts/tahoe_add_alias.py index 7b0752c1..1c03ad5a 100644 --- a/src/allmydata/scripts/tahoe_add_alias.py +++ b/src/allmydata/scripts/tahoe_add_alias.py @@ -1,7 +1,6 @@ import os.path import codecs -import sys from allmydata import uri from allmydata.scripts.common_http import do_http, check_http_error from allmydata.scripts.common import get_aliases diff --git a/src/allmydata/scripts/tahoe_backup.py b/src/allmydata/scripts/tahoe_backup.py index 2b065eb2..425e8eba 100644 --- a/src/allmydata/scripts/tahoe_backup.py +++ b/src/allmydata/scripts/tahoe_backup.py @@ -9,10 +9,8 @@ from allmydata.scripts.common import get_alias, escape_path, DEFAULT_ALIAS, \ from allmydata.scripts.common_http import do_http from allmydata.util import time_format from allmydata.scripts import backupdb -import sys from allmydata.util.stringutils import unicode_to_stdout, listdir_unicode, open_unicode from allmydata.util.assertutil import precondition -from twisted.python import usage class HTTPError(Exception): diff --git a/src/allmydata/scripts/tahoe_cp.py b/src/allmydata/scripts/tahoe_cp.py index 479996a9..02790d08 100644 --- a/src/allmydata/scripts/tahoe_cp.py +++ b/src/allmydata/scripts/tahoe_cp.py @@ -2,14 +2,12 @@ import os.path import urllib import simplejson -import sys from cStringIO import StringIO from twisted.python.failure import Failure from allmydata.scripts.common import get_alias, escape_path, \ DefaultAliasMarker, UnknownAliasError from allmydata.scripts.common_http import do_http from allmydata import uri -from twisted.python import usage from allmydata.util.stringutils import unicode_to_url, listdir_unicode, open_unicode from allmydata.util.assertutil import precondition diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index c7746486..00176a36 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -27,8 +27,7 @@ from allmydata.test.no_network import GridTestMixin from twisted.internet import threads # CLI tests use deferToThread from twisted.python import usage -from allmydata.util.stringutils import listdir_unicode, open_unicode, \ - unicode_platform, FilenameEncodingError +from allmydata.util.stringutils import listdir_unicode, unicode_platform, FilenameEncodingError timeout = 480 # deep_check takes 360s on Zandr's linksys box, others take > 240s @@ -650,7 +649,6 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase): self.basedir = "cli/CreateAlias/create_unicode" self.set_up_grid() - aliasfile = os.path.join(self.get_clientdir(), "private", "aliases") d = self.do_cli("create-alias", "études") def _check_create_unicode((rc,stdout,stderr)): @@ -700,11 +698,11 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase): d.addCallback(lambda res: self.do_cli("get", get_aliases(self.get_clientdir())[u"études"] + "/lumière.txt")) - def _check_get((rc, stdout, stderr)): + def _check_get2((rc, stdout, stderr)): self.failUnlessEqual(rc, 0) self.failIf(stderr) self.failUnlessEqual(stdout, "Let the sunshine In!") - d.addCallback(_check_get) + d.addCallback(_check_get2) return d @@ -986,7 +984,6 @@ class Put(GridTestMixin, CLITestMixin, unittest.TestCase): self.set_up_grid() rel_fn = os.path.join(self.basedir, "DATAFILE") - abs_fn = os.path.abspath(rel_fn) # we make the file small enough to fit in a LIT file, for speed DATA = "short file" f = open(rel_fn, "w") diff --git a/src/allmydata/test/test_sftp.py b/src/allmydata/test/test_sftp.py index 06d38659..87c6c899 100644 --- a/src/allmydata/test/test_sftp.py +++ b/src/allmydata/test/test_sftp.py @@ -1,5 +1,5 @@ -import re, struct, traceback, gc, time, calendar +import re, struct, traceback, time, calendar from stat import S_IFREG, S_IFDIR from twisted.trial import unittest @@ -879,6 +879,7 @@ class Handler(GridTestMixin, ShouldFailMixin, unittest.TestCase): # deliberate race between openFile and renameFile d3 = self.handler.renameFile("new", "new2") + del d3 return d2 d.addCallback(_open_and_rename_race) def _write_rename_race(wf):