From 3cd4722c9bedeba85a9f71fd1e10cf0f62177d6e Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Tue, 27 Jan 2009 14:32:45 -0700
Subject: [PATCH] setup: fix test_runner.RunNode.test_baddir -- it was left
 incomplete and broken by a recent patch

---
 src/allmydata/test/test_runner.py | 37 ++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 16 deletions(-)

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