]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_runner.py: add test for 'tahoe debug trial'.
authorDavid-Sarah Hopwood <david-sarah@jacaranda.org>
Wed, 12 Dec 2012 07:12:05 +0000 (07:12 +0000)
committerDaira Hopwood <daira@jacaranda.org>
Fri, 10 Jul 2015 04:21:31 +0000 (05:21 +0100)
Signed-off-by: David-Sarah Hopwood <david-sarah@jacaranda.org>
src/allmydata/test/test_runner.py

index 3c79777f8f7df8aa1b26e6d4989f443099d23613..cccb78596d6ec9bb69d0e6d67b809f14a1782472 100644 (file)
@@ -222,6 +222,43 @@ class BinTahoe(common_util.SignalMixin, unittest.TestCase, RunBinTahoeMixin):
         d.addCallback(_cb)
         return d
 
+    def test_debug_trial(self):
+        def _check_for_line(lines, result, test):
+            for l in lines:
+                if result in l and test in l:
+                    return
+            self.fail("output (prefixed with '##') does not have a line containing both %r and %r:\n## %s"
+                      % (result, test, "\n## ".join(lines)))
+
+        def _check_for_outcome(lines, out, outcome):
+            self.failUnlessIn(outcome, out, "output (prefixed with '##') does not contain %r:\n## %s"
+                                            % (outcome, "\n## ".join(lines)))
+
+        d = self.run_bintahoe(['debug', 'trial', '--reporter=verbose',
+                               'allmydata.test.trialtest'])
+        def _check_failure( (out, err, rc) ):
+            self.failUnlessEqual(rc, 1)
+            lines = out.split('\n')
+            _check_for_line(lines, "[SKIPPED]", "test_skip")
+            _check_for_line(lines, "[TODO]",    "test_todo")
+            _check_for_line(lines, "[FAIL]",    "test_fail")
+            _check_for_line(lines, "[ERROR]",   "test_deferred_error")
+            _check_for_line(lines, "[ERROR]",   "test_error")
+            _check_for_outcome(lines, out, "FAILED")
+        d.addCallback(_check_failure)
+
+        # the --quiet argument regression-tests a problem in finding which arguments to pass to trial
+        d.addCallback(lambda ign: self.run_bintahoe(['--quiet', 'debug', 'trial', '--reporter=verbose',
+                                                     'allmydata.test.trialtest.Success']))
+        def _check_success( (out, err, rc) ):
+            self.failUnlessEqual(rc, 0)
+            lines = out.split('\n')
+            _check_for_line(lines, "[SKIPPED]", "test_skip")
+            _check_for_line(lines, "[TODO]",    "test_todo")
+            _check_for_outcome(lines, out, "PASSED")
+        d.addCallback(_check_success)
+        return d
+
 
 class CreateNode(unittest.TestCase):
     # exercise "tahoe create-node", create-introducer,