def testList(self):
   """Verify --list works"""
   self.PatchObject(run_tests, 'RunTests', side_effect=Exception('do not run'))
   with self.OutputCapturer() as output:
     run_tests.main(['--list'])
     # Verify some reasonable number of lines showed up.
     self.assertGreater(len(output.GetStdoutLines()), 90)
 def testSpecificTests(self):
   """Verify user specified tests are run."""
   m = self.PatchObject(run_tests, 'RunTests', return_value=True)
   tests = ['./some/foo_unittest', './bar_unittest']
   run_tests.main(tests)
   m.assert_called_with(tests, jobs=mock.ANY, chroot_available=mock.ANY,
                        network=mock.ANY, dryrun=mock.ANY, failfast=mock.ANY)
Beispiel #3
0
 def testList(self):
   """Verify --list works"""
   self.PatchObject(run_tests, 'RunTests', side_effect=Exception('do not run'))
   with self.OutputCapturer() as output:
     run_tests.main(['--list'])
     # Verify some reasonable number of lines showed up.
     self.assertGreater(len(output.GetStdoutLines()), 90)
Beispiel #4
0
 def testSpecificTests(self):
   """Verify user specified tests are run."""
   m = self.PatchObject(run_tests, 'RunTests', return_value=True)
   tests = ['./some/foo_unittest', './bar_unittest']
   run_tests.main(tests)
   m.assert_called_with(tests, jobs=mock.ANY, chroot_available=mock.ANY,
                        network=mock.ANY, dryrun=mock.ANY, failfast=mock.ANY)
Beispiel #5
0
 def testQuick(self):
     """Verify --quick filters out slow tests"""
     self.PatchObject(run_tests, 'RunTests', return_value=True)
     # Pick a test that is in SLOW_TESTS but not in SPECIAL_TESTS.
     slow_test = 'lib/patch_unittest'
     self.assertIn(slow_test, run_tests.SLOW_TESTS)
     self.assertNotIn(slow_test, run_tests.SPECIAL_TESTS)
     run_tests.main(['--quick'])
     self.assertIn(slow_test, run_tests.SPECIAL_TESTS)
 def testQuick(self):
   """Verify --quick filters out slow tests"""
   self.PatchObject(run_tests, 'RunTests', return_value=True)
   # Pick a test that is in SLOW_TESTS but not in SPECIAL_TESTS.
   slow_test = 'lib/patch_unittest'
   self.assertIn(slow_test, run_tests.SLOW_TESTS)
   self.assertNotIn(slow_test, run_tests.SPECIAL_TESTS)
   run_tests.main(['--quick'])
   self.assertIn(slow_test, run_tests.SPECIAL_TESTS)
Beispiel #7
0
 def testMisc(self):
     """Verify basic flags get passed down correctly"""
     m = self.PatchObject(run_tests, 'RunTests', return_value=True)
     run_tests.main(['--network'])
     m.assert_called_with(mock.ANY,
                          jobs=mock.ANY,
                          chroot_available=mock.ANY,
                          network=True,
                          dryrun=False,
                          failfast=False)
     run_tests.main(['--dry-run'])
     m.assert_called_with(mock.ANY,
                          jobs=mock.ANY,
                          chroot_available=mock.ANY,
                          network=False,
                          dryrun=True,
                          failfast=False)
     run_tests.main(['--jobs', '1000'])
     m.assert_called_with(mock.ANY,
                          jobs=1000,
                          chroot_available=mock.ANY,
                          network=False,
                          dryrun=False,
                          failfast=False)
     run_tests.main(['--failfast'])
     m.assert_called_with(mock.ANY,
                          jobs=mock.ANY,
                          chroot_available=mock.ANY,
                          network=False,
                          dryrun=False,
                          failfast=True)
 def testUnknownArg(self):
   """Verify we kick out unknown args"""
   self.PatchObject(run_tests, 'RunTests', side_effect=Exception('do not run'))
   bad_arg = '--foasdf'
   exit_code = None
   # Only run the main code w/the capturer enabled so we don't swallow
   # general test output.
   with self.OutputCapturer():
     try:
       run_tests.main([bad_arg])
     except SystemExit as e:
       exit_code = e.code
   self.assertNotEqual(exit_code, 0,
                       msg='run_tests wrongly accepted %s' % bad_arg)
Beispiel #9
0
 def testUnknownArg(self):
   """Verify we kick out unknown args"""
   self.PatchObject(run_tests, 'RunTests', side_effect=Exception('do not run'))
   bad_arg = '--foasdf'
   exit_code = None
   # Only run the main code w/the capturer enabled so we don't swallow
   # general test output.
   with self.OutputCapturer():
     try:
       run_tests.main([bad_arg])
     except SystemExit as e:
       exit_code = e.code
   self.assertNotEqual(exit_code, 0,
                       msg='run_tests wrongly accepted %s' % bad_arg)
 def testMisc(self):
   """Verify basic flags get passed down correctly"""
   m = self.PatchObject(run_tests, 'RunTests', return_value=True)
   run_tests.main(['--network'])
   m.assert_called_with(mock.ANY, jobs=mock.ANY, chroot_available=mock.ANY,
                        network=True, dryrun=False, failfast=False)
   run_tests.main(['--dry-run'])
   m.assert_called_with(mock.ANY, jobs=mock.ANY, chroot_available=mock.ANY,
                        network=False, dryrun=True, failfast=False)
   run_tests.main(['--jobs', '1000'])
   m.assert_called_with(mock.ANY, jobs=1000, chroot_available=mock.ANY,
                        network=False, dryrun=False, failfast=False)
   run_tests.main(['--failfast'])
   m.assert_called_with(mock.ANY, jobs=mock.ANY, chroot_available=mock.ANY,
                        network=False, dryrun=False, failfast=True)