Exemple #1
0
def main(argv=None):
    if argv is None:
        argv = sys.argv
    try:
        try:
            short = "fst:x:"
            long_ = [ "find-only"
                    , "scripted"
                    , "testcase=","TestCase="
                    , "stopwords="
                     ]
            opts, args = getopt.getopt(argv[1:], short, long_)
        except getopt.error, msg:
            raise Usage(msg)

        find_only = False   # -f
        scripted = False    # -s
        stopwords = []      # -x
        testcase = None     # -t

        for opt, value in opts:
            if opt in ('-f', '--find-only'):
                find_only = True
            elif opt in ('-s', '--scripted'):
                scripted = True
            elif opt in ('-x', '--stopwords'):
                stopwords = value.split(',')
            elif opt in ('-t', '--testcase', '--TestCase'):
                testcase = value

        if len(args) == 1:
            module = args[0]
        else:
            raise Usage("Please specify a module.")

        if WINDOWS or scripted:
            if testcase is None:
                report = summarize(module, find_only, stopwords)
            else:
                report = detail(module, testcase)
            sys.stdout.write(report)
            
            tfail, terr, tall = summarize._Summarize__totals
            if tfail > 0 or terr > 0: return 2 # non-zero exit-code on errors
            else: return 0
        else:
            from assertEquals.interactive import CursesInterface
            CursesInterface(module, stopwords)
Exemple #2
0
 def testTestCaseInSubmodulesWorks(self):
     expected = REPORT_SUCCESS
     actual = detail('assertEqualsTests.itDoesExist', 'TestCase')
     self.assertEqual(expected, actual)
Exemple #3
0
 def testDoesntContainProgramOutput(self):
     actual = detail('assertEqualsTests', 'TestCase')
     start = actual[:len(OUTPUT_START)]
     end = actual[-len(OUTPUT_END):]
     self.assertEqual(start, OUTPUT_START)
     self.assertEqual(end, OUTPUT_END)
Exemple #4
0
 def testReturnsNormalUnitTestOutputWithOurBanner(self):
     actual = detail('assertEqualsTests', 'TestCase')
     start = actual[:len(OUTPUT_START)]
     end = actual[-len(OUTPUT_END):]
     self.assertEqual(start, OUTPUT_START)
     self.assertEqual(end, OUTPUT_END)