Esempio n. 1
0
 def testWrongTwo(self):
     with self.assertRaisesRegexp(Exception, "expects 2 args, got 0."):
         annotator.MatchAnnotation('@@@STEP_LOG_LINE@@@', self.c)
     with self.assertRaisesRegexp(Exception, "expects 2 args, got 1."):
         annotator.MatchAnnotation('@@@STEP_LOG_LINE @@@', self.c)
     with self.assertRaisesRegexp(Exception, "expects 2 args, got 1."):
         annotator.MatchAnnotation('@@@STEP_LOG_LINE@foo@@@', self.c)
Esempio n. 2
0
 def testNonAnnotated(self):
     annotator.MatchAnnotation('@not really an annotation', self.c)
     annotator.MatchAnnotation('@@@also not really an annotation@@', self.c)
     annotator.MatchAnnotation('#@@@totally not an annotation@@@', self.c)
     annotator.MatchAnnotation('###clearly not an annotation###', self.c)
     annotator.MatchAnnotation('@@@', self.c)
     self.assertEqual(self.c.called, [])
Esempio n. 3
0
 def testAlias(self):
     annotator.MatchAnnotation('@@@BUILD_WARNINGS@@@', self.c)
     annotator.MatchAnnotation('@@@link@foo@bar@trashcan@@@', self.c)
     self.assertEqual(self.c.called, [
         ('STEP_WARNINGS', []),
         ('STEP_LINK', ['foo', 'bar@trashcan']),
     ])
Esempio n. 4
0
 def testOneAnnotated(self):
   annotator.MatchAnnotation('@@@SEED_STEP@@@@', self.c)
   annotator.MatchAnnotation('@@@SEED_STEP@foo bar@@@', self.c)
   annotator.MatchAnnotation('@@@SEED_STEP bat fur@@@', self.c)
   annotator.MatchAnnotation('@@@SEED_STEP@ doom cake@@@', self.c)
   annotator.MatchAnnotation('@@@SEED_STEP  sooper p@nts@@@', self.c)
   self.assertEqual(self.c.called, [
     ('SEED_STEP', ['']),
     ('SEED_STEP', ['foo bar']),
     ('SEED_STEP', ['bat fur']),
     ('SEED_STEP', [' doom cake']),
     ('SEED_STEP', [' sooper p@nts']),
   ])
Esempio n. 5
0
 def testTrigger(self):
     annotator.MatchAnnotation(
         '@@@STEP_TRIGGER {"builderNames": ["myBuilder"]}@@@', self.c)
     annotator.MatchAnnotation((
         '@@@STEP_TRIGGER {"builderNames": ["myBuilder"], "set_properties":'
         '{"answer": 42}}@@@'), self.c)
     self.assertEqual(self.c.called, [
         ('STEP_TRIGGER', [{
             u'builderNames': [u'myBuilder']
         }]),
         ('STEP_TRIGGER', [{
             u'builderNames': [u'myBuilder'],
             u'set_properties': {
                 u'answer': 42
             },
         }]),
     ])
Esempio n. 6
0
 def testTwoAnnotated(self):
     annotator.MatchAnnotation('@@@STEP_LOG_LINE@foo bar@ awesome line!@@@',
                               self.c)
     annotator.MatchAnnotation('@@@STEP_LOG_LINE bat fur@ cool line.@@@',
                               self.c)
     annotator.MatchAnnotation('@@@STEP_LOG_LINE@ doom cake@ok@line :/@@@',
                               self.c)
     annotator.MatchAnnotation('@@@STEP_LOG_LINE  sooper pants@ pants@@@',
                               self.c)
     annotator.MatchAnnotation('@@@STEP_LOG_LINE @@@@', self.c)
     self.assertEqual(self.c.called, [
         ('STEP_LOG_LINE', ['foo bar', ' awesome line!']),
         ('STEP_LOG_LINE', ['bat fur', ' cool line.']),
         ('STEP_LOG_LINE', [' doom cake', 'ok@line :/']),
         ('STEP_LOG_LINE', [' sooper pants', ' pants']),
         ('STEP_LOG_LINE', ['', '']),
     ])
Esempio n. 7
0
 def testMissingImpl(self):
     with self.assertRaisesRegexp(Exception, "does not implement"):
         annotator.MatchAnnotation('@@@SEED_STEP_TEXT@thingy@i like pie@@@',
                                   self.c)
Esempio n. 8
0
 def testBadAnnotation(self):
     with self.assertRaisesRegexp(Exception, "Unrecognized annotator"):
         annotator.MatchAnnotation('@@@SOME_OTHER_METHOD@@@', self.c)
Esempio n. 9
0
 def testWrongImpl(self):
     with self.assertRaisesRegexp(TypeError, "takes exactly 1 argument"):
         annotator.MatchAnnotation('@@@STEP_CURSOR@p-pow!@@@', self.c)
Esempio n. 10
0
 def testWrongZero(self):
     with self.assertRaisesRegexp(Exception, "expects 1 args, got 0."):
         annotator.MatchAnnotation('@@@SEED_STEP@@@', self.c)
Esempio n. 11
0
 def testZeroCruft(self):
     with self.assertRaisesRegexp(Exception, "cruft"):
         annotator.MatchAnnotation('@@@STEP_WARNINGS flazoo@@@', self.c)
Esempio n. 12
0
 def testZeroAnnotatedCruft(self):
     with self.assertRaisesRegexp(Exception, 'cruft "@"'):
         annotator.MatchAnnotation('@@@STEP_WARNINGS@@@@', self.c)
     with self.assertRaisesRegexp(Exception, 'cruft " "'):
         annotator.MatchAnnotation('@@@STEP_WARNINGS @@@', self.c)
Esempio n. 13
0
 def testZeroAnnotated(self):
     annotator.MatchAnnotation('@@@STEP_WARNINGS@@@', self.c)
     self.assertEqual(self.c.called, [
         ('STEP_WARNINGS', []),
     ])
Esempio n. 14
0
  def handleOutputLine(self, line):
    """This is called once with each line of the test log."""
    # Handle initial setup here, as step_status might not exist yet at init.
    self.initialSection()

    annotator.MatchAnnotation(line.rstrip(), self)