Beispiel #1
0
    def find_tests(test_suite, suite_path):
        def patterned(test, patterns):
            answer = []
            for i in patterns:
                if test.name.find(i) != -1:
                    answer.append(test)
            return answer

        test_suite.ini['suite'] = suite_path
        tests = glob.glob(os.path.join(suite_path, "*.test"))

        if not tests:
            executable_path_glob = os.path.join(test_suite.args.builddir,
                                                'test', suite_path, '*.test')
            tests = glob.glob(executable_path_glob)

        tests = Server.exclude_tests(tests, test_suite.args.exclude)
        test_suite.tests = [
            UnitTest(k, test_suite.args, test_suite.ini) for k in sorted(tests)
        ]
        test_suite.tests = sum(
            [patterned(x, test_suite.args.tests) for x in test_suite.tests],
            [])
Beispiel #2
0
    def find_tests(test_suite, suite_path):
        def patterned(test_name, patterns):
            answer = []
            for i in patterns:
                if test_name.find(i) != -1:
                    answer.append(test_name)
            return answer

        def is_correct(run):
            return test_suite.args.conf is None or test_suite.args.conf == run

        test_suite.ini['suite'] = suite_path

        test_names = sorted(glob.glob(os.path.join(suite_path, "*.test.lua")))
        test_names = Server.exclude_tests(test_names, test_suite.args.exclude)
        test_names = sum(
            map((lambda x: patterned(x, test_suite.args.tests)), test_names),
            [])
        tests = []

        for test_name in test_names:
            runs = test_suite.get_multirun_params(test_name)
            if runs:
                tests.extend([
                    AppTest(test_name,
                            test_suite.args,
                            test_suite.ini,
                            params=params,
                            conf_name=conf_name)
                    for conf_name, params in runs.iteritems()
                    if is_correct(conf_name)
                ])
            else:
                tests.append(
                    AppTest(test_name, test_suite.args, test_suite.ini))

        test_suite.tests = tests
 def get_tests(*patterns):
     res = []
     for pattern in patterns:
         path_pattern = os.path.join(suite_path, pattern)
         res.extend(sorted(glob.glob(path_pattern)))
     return Server.exclude_tests(res, test_suite.args.exclude)