Exemplo n.º 1
0
 def test_get_test_cases_dupes_if_case_given(self):
     tempdir = tempfile.mkdtemp()
     testdir = abspath(tempdir, 'testdata')
     os.makedirs(testdir)
     fin = abspath(testdir, 'foo.in')
     fout = abspath(testdir, 'foo.out')
     open(fin, 'w')
     open(fout, 'w')
     self.command.namespace.case = fin
     cases = self.command.get_test_cases(tempdir)
     try:
         self.assertEqual(cases, [(fin, fout)])
     finally:
         shutil.rmtree(tempdir)
Exemplo n.º 2
0
    def handle_label(self, label, namespace):
        self.namespace = namespace
        dirname = label or abspath(curdir())

        title = 'Testing %s' % dirname
        subtitle = '=' * len(title)
        self.success_continuation(title)
        self.success_continuation(subtitle)
        print()

        binary = self.get_binary(dirname, namespace.lang)
        self.info("Binary: %s" % binary)
        print()

        time = 0
        total = 0
        fails = 0
        #print(self.get_test_cases(dirname))
        for fin, fout in self.get_test_cases(dirname):
            total += 1
            info = self.test(dirname, binary, fin, fout)
            time += info['time']
            if not info['success']:
                fails += 1

        print()
        self.info("Total time: %.3fs" % time)
        if fails == 0:
            self.success('All %s tests passed' % total)
        else:
            self.error('%s out of %s tests failed' % (fails, total))
Exemplo n.º 3
0
    def handle_label(self, label, namespace):
        self.namespace = namespace
        dirname = label or abspath(curdir())

        title = 'Testing %s' % dirname
        subtitle = '=' * len(title)
        self.success_continuation(title)
        self.success_continuation(subtitle)
        print()

        binary = self.get_binary(dirname, namespace.lang)
        self.info("Binary: %s" % binary)
        print()

        time = 0
        total = 0
        fails = 0
        for fin, fout in self.get_test_cases(dirname):
            total += 1
            info = self.test(dirname, binary, fin, fout)
            time += info['time']
            if not info['success']:
                fails += 1

        print()
        self.info("Total time: %.3fs" % time)
        if fails == 0:
            self.success('All %s tests passed' % total)
        else:
            self.error('%s out of %s tests failed' % (fails, total))