From: Zooko O'Whielacronx Date: Tue, 27 Jan 2009 21:32:45 +0000 (-0700) Subject: setup: fix test_runner.RunNode.test_baddir -- it was left incomplete and broken by... X-Git-Tag: allmydata-tahoe-1.3.0~138 X-Git-Url: https://git.rkrishnan.org/pf/content/%22news.html/about.html?a=commitdiff_plain;h=3cd4722c9bedeba85a9f71fd1e10cf0f62177d6e;p=tahoe-lafs%2Ftahoe-lafs.git setup: fix test_runner.RunNode.test_baddir -- it was left incomplete and broken by a recent patch --- diff --git a/src/allmydata/test/test_runner.py b/src/allmydata/test/test_runner.py index 03f797cb..7e0f084c 100644 --- a/src/allmydata/test/test_runner.py +++ b/src/allmydata/test/test_runner.py @@ -431,22 +431,27 @@ class RunNode(unittest.TestCase, pollmixin.PollMixin, common_util.SignalMixin): self.failUnless("does not look like a node directory" in err) d.addCallback(_cb) - d.addCallback - - argv = ["--quiet", "stop", "--basedir", basedir] - out,err = StringIO(), StringIO() - rc = runner.runner(argv, stdout=out, stderr=err) - self.failUnlessEqual(rc, 2) - self.failUnless("does not look like a running node directory" - in err.getvalue()) - - not_a_dir = os.path.join(basedir, "bogus") - argv = ["--quiet", "start", "--basedir", not_a_dir] - out,err = StringIO(), StringIO() - rc = runner.runner(argv, stdout=out, stderr=err) - self.failUnlessEqual(rc, 1) - self.failUnless("does not look like a directory at all" - in err.getvalue(), err.getvalue()) + def _then_stop_it(res): + return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "stop", "--basedir", basedir], env=os.environ) + d.addCallback(_then_stop_it) + + def _cb2(res): + out, err, rc_or_sig = res + self.failUnlessEqual(rc_or_sig, 2) + self.failUnless("does not look like a running node directory" in err) + d.addCallback(_cb2) + + def _then_start_in_bogus_basedir(res): + not_a_dir = os.path.join(basedir, "bogus") + return utils.getProcessOutputAndValue(bintahoe, args=["--quiet", "start", "--basedir", not_a_dir], env=os.environ) + d.addCallback(_then_start_in_bogus_basedir) + + def _cb3(res): + out, err, rc_or_sig = res + self.failUnlessEqual(rc_or_sig, 1) + self.failUnless("does not look like a directory at all" in err, err) + d.addCallback(_cb3) + return d def test_keygen(self): if not os.path.exists(bintahoe):