示例#1
0
文件: run.py 项目: dbrgn/jedi
def test_dir(completion_test_dir, thirdparty=False):
    global tests_fail
    for f_name in os.listdir(completion_test_dir):
        files_to_execute = [a for a in test_files.items() if a[0] in f_name]
        lines_to_execute = reduce(lambda x, y: x + y[1], files_to_execute, [])
        if f_name.endswith(".py") and (not test_files or files_to_execute):
            # for python2.5 certain tests are not being done, because it
            # only has these features partially.
            if is_py25 and f_name in ['generators.py', 'types.py']:
                continue

            if thirdparty:
                try:
                    # there is always an underline at the end.
                    # It looks like: completion/thirdparty/pylab_.py
                    __import__(f_name.replace('_.py', ''))
                except ImportError:
                    summary.append('Thirdparty-Library %s not found.' %
                                                                    f_name)
                    continue

            path = os.path.join(completion_test_dir, f_name)
            f = open(path)
            num_tests, fails = run_test(f.read(), f_name, lines_to_execute)
            global test_sum
            test_sum += num_tests

            s = 'run %s tests with %s fails (%s)' % (num_tests, fails, f_name)
            tests_fail += fails
            print(s)
            summary.append(s)
示例#2
0
def test_dir(completion_test_dir, thirdparty=False):
    global tests_fail
    for f_name in os.listdir(completion_test_dir):
        files_to_execute = [a for a in test_files.items() if a[0] in f_name]
        lines_to_execute = reduce(lambda x, y: x + y[1], files_to_execute, [])
        if f_name.endswith(".py") and (not test_files or files_to_execute):
            # for python2.5 certain tests are not being done, because it
            # only has these features partially.
            if is_py25 and f_name in ['generators.py', 'types.py']:
                continue

            if thirdparty:
                try:
                    # there is always an underline at the end.
                    # It looks like: completion/thirdparty/pylab_.py
                    __import__(f_name.replace('_.py', ''))
                except ImportError:
                    summary.append('Thirdparty-Library %s not found.' %
                                                                    f_name)
                    continue

            path = os.path.join(completion_test_dir, f_name)
            f = open(path)
            num_tests, fails = run_test(f.read(), f_name, lines_to_execute)

            s = 'run %s tests with %s fails (%s)' % (num_tests, fails, f_name)
            tests_fail += fails
            print(s)
            summary.append(s)
示例#3
0
文件: fast_parser.py 项目: dbrgn/jedi
 def _get(self, name, operation, execute=False, *args, **kwargs):
     key = (name, args, frozenset(kwargs.items()))
     if key not in self.cache:
         if execute:
             objs = (getattr(p.module, name)(*args, **kwargs)
                                                 for p in self.parsers)
         else:
             objs = (getattr(p.module, name) for p in self.parsers)
         self.cache[key] = reduce(operation, objs)
     return self.cache[key]
示例#4
0
 def _get(self, name, operation, execute=False, *args, **kwargs):
     key = (name, args, frozenset(kwargs.items()))
     if key not in self.cache:
         if execute:
             objs = (getattr(p.module, name)(*args, **kwargs)
                                                 for p in self.parsers)
         else:
             objs = (getattr(p.module, name) for p in self.parsers)
         self.cache[key] = reduce(operation, objs)
     return self.cache[key]