예제 #1
0
    def test_list_suites(self):
        # for suites affecting all of this class's tests
        num_tests = len(list(self.runnable_test_methods()))

        test_runner = TestRunner(type(self))
        assert_equal(test_runner.list_suites(), {
            'disabled': '2 tests',
            'module-level': '%d tests' % num_tests,
            'class-level-suite': '%d tests' % num_tests,
            'crazy': '1 tests'
        })
예제 #2
0
    def test_list_suites(self):
        # for suites affecting all of this class's tests
        num_tests = len(list(self.runnable_test_methods()))

        test_runner = TestRunner(type(self))
        assert_equal(sorted(test_runner.list_suites().items()), [
            ('assertion', '1 tests'),
            ('class-level-suite', '%d tests' % num_tests),
            ('crazy', '1 tests'),
            ('disabled', '2 tests'),
            ('example', '%d tests' % num_tests),
            ('module-level', '%d tests' % num_tests),
        ])
예제 #3
0
    def test_list_suites(self):
        # for suites affecting all of this class's tests
        num_tests = len(list(self.runnable_test_methods()))

        test_runner = TestRunner(type(self))
        assert_equal(sorted(test_runner.list_suites().items()), [
            ('assertion', '1 tests'),
            ('class-level-suite', '%d tests' % num_tests),
            ('crazy', '1 tests'),
            ('disabled', '2 tests'),
            ('example', '%d tests' % num_tests),
            ('module-level', '%d tests' % num_tests),
        ])
예제 #4
0
    def __init__(self, command_line_args=None):
        """Initialize and run the test with the given command_line_args
            command_line_args will be passed to parser.parse_args
        """
        command_line_args = command_line_args or sys.argv[1:]

        runner_action, test_path, test_runner_args, other_opts = parse_test_runner_command_line_args(command_line_args)
        
        self.setup_logging(other_opts)
        
        runner = TestRunner(**test_runner_args)

        runner.discover(test_path, bucket=other_opts.bucket, bucket_count=other_opts.bucket_count)

        if runner_action == ACTION_LIST_SUITES:
            runner.list_suites()
            sys.exit(0)
        elif runner_action == ACTION_LIST_TESTS:
            runner.list_tests()
            sys.exit(0)
        elif runner_action == ACTION_RUN_TESTS:
            result = runner.run()
            sys.exit(not result)