def test_slowest(self): namespace = os_testr.get_parser(['--slowest']) self.assertEqual(True, namespace.slowest) namespace = os_testr.get_parser(['--no-slowest']) self.assertEqual(False, namespace.slowest) self.assertRaises(SystemExit, os_testr.get_parser, ['--no-slowest', '--slowest'])
def test_parallel(self): namespace = os_testr.get_parser(['--parallel']) self.assertEqual(True, namespace.parallel) namespace = os_testr.get_parser(['--serial']) self.assertEqual(False, namespace.parallel) self.assertRaises(SystemExit, os_testr.get_parser, ['--parallel', '--serial'])
def test_pretty(self): namespace = os_testr.get_parser(['--pretty']) self.assertEqual(True, namespace.pretty) namespace = os_testr.get_parser(['--no-pretty']) self.assertEqual(False, namespace.pretty) self.assertRaises(SystemExit, os_testr.get_parser, ['--no-pretty', '--pretty'])
def test_pdb(self): namespace = os_testr.get_parser(['--pdb', 'project.tests.foo']) def _fake_exit(arg): self.assertTrue(arg) def _fake_run(*args, **kwargs): return 'project.tests.foo' in args with mock.patch.object(os_testr, 'exit', side_effect=_fake_exit), \ mock.patch.object(os_testr, 'get_parser', return_value=namespace), \ mock.patch.object(os_testr, 'call_subunit_run', side_effect=_fake_run): os_testr.main()