예제 #1
0
 def test_failing_load_test(self):
     h = Host()
     orig_wd = h.getcwd()
     tmpdir = None
     try:
         tmpdir = h.mkdtemp()
         h.chdir(tmpdir)
         h.write_text_file(
             'load_test.py',
             d("""\
             import unittest
             def load_tests(_, _2, _3):
                 assert False
             """))
         test_set = TestSet(MockArgs())
         test_set.parallel_tests = [TestInput('load_test.BaseTest.test_x')]
         r = Runner()
         r.args.jobs = 1
         ret, _, trace = r.run(test_set)
         self.assertEqual(ret, 1)
         self.assertIn('BaseTest', trace['traceEvents'][0]['args']['err'])
     finally:
         h.chdir(orig_wd)
         if tmpdir:
             h.rmtree(tmpdir)
예제 #2
0
 def test_missing_name(self):
     test_set = TestSet(MockArgs())
     test_set.parallel_tests = [TestInput('nonexistent test')]
     r = Runner()
     r.args.jobs = 1
     ret, _, _ = r.run(test_set)
     self.assertEqual(ret, 1)
예제 #3
0
 def test_missing_name(self):
     test_set = TestSet(MockArgs())
     test_set.parallel_tests = [TestInput('nonexistent test')]
     r = Runner()
     r.args.jobs = 1
     ret, _, _ = r.run(test_set)
     self.assertEqual(ret, 1)
예제 #4
0
 def test_failing_load_test(self):
     h = Host()
     orig_wd = h.getcwd()
     tmpdir = None
     try:
         tmpdir = h.mkdtemp()
         h.chdir(tmpdir)
         h.write_text_file('load_test.py', d("""\
             import unittest
             def load_tests(_, _2, _3):
                 assert False
             """))
         test_set = TestSet()
         test_set.parallel_tests = [TestInput('load_test.BaseTest.test_x')]
         r = Runner()
         r.args.jobs = 1
         ret, _, trace = r.run(test_set)
         self.assertEqual(ret, 1)
         self.assertIn('Failed to load "load_test.BaseTest.test_x" in '
                       'run_one_test',
                       trace['traceEvents'][0]['args']['err'])
     finally:
         h.chdir(orig_wd)
         if tmpdir:
             h.rmtree(tmpdir)
예제 #5
0
 def _PrefixDoesNotMatch(self, runner):
     test_set = TestSet(runner.args.test_name_prefix)
     with self.assertRaises(AssertionError) as context:
         runner.default_classifier(test_set, MockTestCase('test_pass'))
     self.assertIn(
         'The test prefix passed at the command line does not match the prefix '
         'of all the tests generated', str(context.exception))
예제 #6
0
def _PrefixDoesMatch(runner):
    test_set = TestSet(runner.args.test_name_prefix)
    runner.default_classifier(test_set, MockTestCase('test_pass'))
    return test_set