Beispiel #1
0
 def _get_tap_result(stdout):
     parser = TapParser(io.StringIO(stdout.decode()))
     result = "error"
     for event in parser.parse():
         if isinstance(event, TapParser.Bailout):
             result = "error"
             break
         elif isinstance(event, TapParser.Error):
             result = "error"
             break
         elif isinstance(event, TapParser.Plan):
             if event.skipped:
                 result = "skip"
                 break
         elif isinstance(event, TapParser.Test):
             if event.result in (TestResult.XPASS, TestResult.FAIL):
                 result = "fail"
                 break
             elif event.result == TestResult.SKIP:
                 result = "skip"
                 break
             else:
                 result = "pass"
     return result
Beispiel #2
0
 def parse_tap(self, s):
     parser = TapParser(io.StringIO(s))
     return iter(parser.parse())
Beispiel #3
0
 def assert_bailout(self, events, **kwargs):
     self.assertEqual(next(events), TapParser.Bailout(**kwargs))
Beispiel #4
0
 def assert_version(self, events, **kwargs):
     self.assertEqual(next(events), TapParser.Version(**kwargs))
Beispiel #5
0
 def assert_plan(self, events, **kwargs):
     if "skipped" not in kwargs:
         kwargs["skipped"] = False
     if "explanation" not in kwargs:
         kwargs["explanation"] = None
     self.assertEqual(next(events), TapParser.Plan(**kwargs))
Beispiel #6
0
 def assert_test(self, events, **kwargs):
     if "explanation" not in kwargs:
         kwargs["explanation"] = None
     self.assertEqual(next(events), TapParser.Test(**kwargs))
Beispiel #7
0
 def assert_plan(self, events, **kwargs):
     if 'skipped' not in kwargs:
         kwargs['skipped'] = False
     if 'explanation' not in kwargs:
         kwargs['explanation'] = None
     self.assertEqual(next(events), TapParser.Plan(**kwargs))