test_runner: better diagnostics in case test_client fails

This commit is contained in:
Brian Warner 2007-09-18 20:03:18 -07:00
parent 2886c5aeae
commit a5fab9935b

View File

@ -127,9 +127,11 @@ class RunNode(unittest.TestCase, testutil.PollMixin):
argv = ["--quiet", "start", c1] argv = ["--quiet", "start", c1]
out,err = StringIO(), StringIO() out,err = StringIO(), StringIO()
rc = runner.runner(argv, stdout=out, stderr=err) rc = runner.runner(argv, stdout=out, stderr=err)
self.failUnlessEqual(rc, 0) outs = out.getvalue() ; errs = err.getvalue()
self.failUnlessEqual(out.getvalue(), "") errstr = "OUT: '%s', ERR: '%s'" % (outs, errs)
self.failUnlessEqual(err.getvalue(), "") self.failUnlessEqual(rc, 0, errstr)
self.failUnlessEqual(outs, "", errstr)
self.failUnlessEqual(errs, "", errstr)
# the parent (twistd) has exited. However, twistd writes the pid from # the parent (twistd) has exited. However, twistd writes the pid from
# the child, not the parent, so we can't expect twistd.pid to exist # the child, not the parent, so we can't expect twistd.pid to exist
@ -152,9 +154,11 @@ class RunNode(unittest.TestCase, testutil.PollMixin):
argv = ["--quiet", "restart", c1] argv = ["--quiet", "restart", c1]
out,err = StringIO(), StringIO() out,err = StringIO(), StringIO()
rc = runner.runner(argv, stdout=out, stderr=err) rc = runner.runner(argv, stdout=out, stderr=err)
self.failUnlessEqual(rc, 0) outs = out.getvalue() ; errs = err.getvalue()
self.failUnlessEqual(out.getvalue(), "") errstr = "OUT: '%s', ERR: '%s'" % (outs, errs)
self.failUnlessEqual(err.getvalue(), "") self.failUnlessEqual(rc, 0, errstr)
self.failUnlessEqual(outs, "", errstr)
self.failUnlessEqual(errs, "", errstr)
d.addCallback(_started) d.addCallback(_started)
# again, the second incarnation of the node might not be ready yet, # again, the second incarnation of the node might not be ready yet,
@ -168,9 +172,11 @@ class RunNode(unittest.TestCase, testutil.PollMixin):
out,err = StringIO(), StringIO() out,err = StringIO(), StringIO()
rc = runner.runner(argv, stdout=out, stderr=err) rc = runner.runner(argv, stdout=out, stderr=err)
# the parent has exited by now # the parent has exited by now
self.failUnlessEqual(rc, 0) outs = out.getvalue() ; errs = err.getvalue()
self.failUnlessEqual(out.getvalue(), "") errstr = "OUT: '%s', ERR: '%s'" % (outs, errs)
self.failUnlessEqual(err.getvalue(), "") self.failUnlessEqual(rc, 0, errstr)
self.failUnlessEqual(outs, "", errstr)
self.failUnlessEqual(errs, "", errstr)
# the parent was supposed to poll and wait until it sees # the parent was supposed to poll and wait until it sees
# twistd.pid go away before it exits, so twistd.pid should be # twistd.pid go away before it exits, so twistd.pid should be
# gone by now. # gone by now.