Esempio n. 1
0
 def _parse_result(self, ok, match, fh=None):
     """Parse a matching result line into a result instance."""
     peek_match = None
     try:
         if fh is not None and ENABLE_VERSION_13 and isinstance(
                 fh, peekable):
             peek_match = self.yaml_block_start.match(fh.peek())
     except StopIteration:
         pass
     if peek_match is None:
         return Result(
             ok,
             number=match.group("number"),
             description=match.group("description").strip(),
             directive=Directive(match.group("directive")),
         )
     indent = peek_match.group("indent")
     concat_yaml = self._extract_yaml_block(indent, fh)
     return Result(
         ok,
         number=match.group("number"),
         description=match.group("description").strip(),
         directive=Directive(match.group("directive")),
         raw_yaml_block=concat_yaml,
     )
Esempio n. 2
0
 def add_not_ok(
         self, class_name, description, directive='', diagnostics=None):
     result = Result(
         ok=False, number=self._get_next_line_number(class_name),
         description=description, diagnostics=diagnostics,
         directive=Directive(directive))
     self._add_line(class_name, result)
Esempio n. 3
0
 def add_skip(self, class_name, description, reason):
     directive = 'SKIP {0}'.format(reason)
     result = Result(ok=True,
                     number=self._get_next_line_number(class_name),
                     description=description,
                     directive=Directive(directive))
     self._add_line(class_name, result)
Esempio n. 4
0
 def add_ok(self, class_name, description, directive=""):
     result = Result(
         ok=True,
         number=self._get_next_line_number(class_name),
         description=description,
         directive=Directive(directive),
     )
     self._add_line(class_name, result)
Esempio n. 5
0
 def _parse_result(self, ok, match, fh=None):
     """Parse a matching result line into a result instance."""
     peek_match = None
     try:
         if fh is not None and self._try_peeking:
             peek_match = self.yaml_block_start.match(fh.peek())
     except StopIteration:
         pass
     if peek_match is None:
         return Result(ok,
                       number=match.group('number'),
                       description=match.group('description').strip(),
                       directive=Directive(match.group('directive')))
     indent = peek_match.group('indent')
     concat_yaml = self._extract_yaml_block(indent, fh)
     return Result(ok,
                   number=match.group('number'),
                   description=match.group('description').strip(),
                   directive=Directive(match.group('directive')),
                   raw_yaml_block=concat_yaml)
Esempio n. 6
0
 def add_not_ok(self, class_name, description, directive=''):
     result = Result(ok=False,
                     number=self._get_next_line_number(class_name),
                     description=description)
     self._add_line(class_name, result)
Esempio n. 7
0
 def test_str_directive(self):
     directive = Directive('SKIP a reason')
     result = Result(True, 44, 'passing', directive)
     self.assertEqual('ok 44 - passing # SKIP a reason', str(result))
Esempio n. 8
0
 def _parse_result(self, ok, match):
     """Parse a matching result line into a result instance."""
     return Result(ok, match.group('number'),
                   match.group('description').strip(),
                   Directive(match.group('directive')))
Esempio n. 9
0
 def test_str_ok(self):
     result = Result(True, 42, 'passing')
     self.assertEqual('ok 42 - passing', str(result))
Esempio n. 10
0
 def test_str_not_ok(self):
     result = Result(False, 43, 'failing')
     self.assertEqual('not ok 43 - failing', str(result))
Esempio n. 11
0
 def test_category(self):
     result = Result(True)
     self.assertEqual('test', result.category)
Esempio n. 12
0
 def test_ok(self):
     result = Result(True)
     self.assertTrue(result.ok)
Esempio n. 13
0
 def handle_skipping_plan(self, skip_plan):
     """Handle a plan that contains a SKIP directive."""
     skip_line = Result(True, None, skip_plan.directive.text,
                        Directive("SKIP"))
     self._suite.addTest(Adapter(self._filename, skip_line))
Esempio n. 14
0
 def test_str_ok(self):
     result = Result(True, 42, "passing")
     self.assertEqual("ok 42 passing", str(result))
Esempio n. 15
0
 def make_not_ok(self, directive_text=""):
     return Result(False, 1, "This is a description.",
                   Directive(directive_text))
Esempio n. 16
0
 def test_str_not_ok(self):
     result = Result(False, 43, "failing")
     self.assertEqual("not ok 43 failing", str(result))
Esempio n. 17
0
 def test_str_directive(self):
     directive = Directive("SKIP a reason")
     result = Result(True, 44, "passing", directive)
     self.assertEqual("ok 44 passing # SKIP a reason", str(result))
Esempio n. 18
0
 def make_not_ok(self, directive_text=''):
     return Result(False, 1, 'This is a description.',
                   Directive(directive_text))
Esempio n. 19
0
 def test_str_diagnostics(self):
     result = Result(False, 43, "failing", diagnostics="# more info")
     self.assertEqual("not ok 43 failing\n# more info", str(result))
Esempio n. 20
0
 def _add_error(self, message):
     """Add an error test to the suite."""
     error_line = Result(False, None, message, Directive(""))
     self._suite.addTest(Adapter(self._filename, error_line))
Esempio n. 21
0
 def test_str_diagnostics(self):
     result = Result(False, 43, 'failing', diagnostics='# more info')
     self.assertEqual('not ok 43 failing\n# more info', str(result))