예제 #1
0
파일: testsamples.py 프로젝트: paroma/mypy
 def test_samples(self) -> None:
     for f in find_files(os.path.join('test-data', 'samples'), suffix='.py'):
         mypy_args = ['--no-strict-optional', '--no-new-semantic-analyzer']
         if f == os.path.join('test-data', 'samples', 'crawl2.py'):
             # This test requires 3.5 for async functions
             mypy_args.append('--python-version=3.5')
         run_mypy(mypy_args + [f])
예제 #2
0
 def test_samples(self) -> None:
     for f in find_files(os.path.join('test-data', 'samples'), suffix='.py'):
         mypy_args = ['--no-strict-optional']
         if f == os.path.join('test-data', 'samples', 'crawl2.py'):
             # This test requires 3.5 for async functions
             mypy_args.append('--python-version=3.5')
         run_mypy(mypy_args + [f])
예제 #3
0
파일: testsamples.py 프로젝트: paroma/mypy
 def test_stdlibsamples(self) -> None:
     seen = set()  # type: Set[str]
     stdlibsamples_dir = os.path.join('test-data', 'stdlib-samples', '3.2', 'test')
     modules = []  # type: List[str]
     for f in find_files(stdlibsamples_dir, prefix='test_', suffix='.py'):
         if f not in seen:
             seen.add(f)
             modules.append(f)
     if modules:
         # TODO: Remove need for --no-strict-optional
         run_mypy(['--no-strict-optional', '--platform=linux'] + modules)
예제 #4
0
 def test_stdlibsamples(self) -> None:
     seen = set()  # type: Set[str]
     stdlibsamples_dir = os.path.join('test-data', 'stdlib-samples', '3.2', 'test')
     modules = []  # type: List[str]
     for f in find_files(stdlibsamples_dir, prefix='test_', suffix='.py'):
         if f not in seen:
             seen.add(f)
             modules.append(f)
     if modules:
         # TODO: Remove need for --no-strict-optional
         run_mypy(['--no-strict-optional', '--platform=linux'] + modules)
예제 #5
0
파일: testsamples.py 프로젝트: paroma/mypy
    def check_stubs(self, version: str, *directories: str) -> None:
        if not directories:
            directories = (version,)
        for stub_type in ['stdlib', 'third_party']:
            for dir in directories:
                seen = {'__builtin__'}  # we don't want to check __builtin__, as it causes problems
                modules = []
                stubdir = os.path.join('typeshed', stub_type, dir)
                for f in find_files(stubdir, suffix='.pyi'):
                    module = file_to_module(f[len(stubdir) + 1:])
                    if module not in seen:
                        seen.add(module)
                        modules.extend(['-m', module])

                if modules:
                    run_mypy(['--python-version={}'.format(version)] + modules)
예제 #6
0
    def check_stubs(self, version: str, *directories: str) -> None:
        if not directories:
            directories = (version,)
        for stub_type in ['stdlib', 'third_party']:
            for dir in directories:
                seen = {'__builtin__'}  # we don't want to check __builtin__, as it causes problems
                modules = []
                stubdir = os.path.join('typeshed', stub_type, dir)
                for f in find_files(stubdir, suffix='.pyi'):
                    module = file_to_module(f[len(stubdir) + 1:])
                    if module not in seen:
                        seen.add(module)
                        modules.extend(['-m', module])

                if modules:
                    run_mypy(['--python-version={}'.format(version)] + modules)
예제 #7
0
 def test_stubs(self) -> None:
     # We only test each module in the one version mypy prefers to find.
     # TODO: test stubs for other versions, especially Python 2 stubs.
     seen = set()  # type: Set[str]
     modules = []
     # TODO: This should also test Python 2, and pass pyversion accordingly.
     for version in ["2and3", "3", "3.5"]:
         # FIX: remove 'builtins', this directory does not exist
         for stub_type in ['builtins', 'stdlib', 'third_party']:
             stubdir = os.path.join('typeshed', stub_type, version)
             for f in find_files(stubdir, suffix='.pyi'):
                 module = file_to_module(f[len(stubdir) + 1:])
                 if module not in seen:
                     seen.add(module)
                     modules.extend(['-m', module])
     if modules:
         # these require at least 3.5 otherwise it will fail trying to import zipapp
         run_mypy(['--python-version=3.5'] + modules)
예제 #8
0
 def test_testrunner(self) -> None:
     run_mypy([
         '--config-file', 'mypy_self_check.ini', '--no-warn-unused-configs',
         'runtests.py', 'waiter.py'
     ])
예제 #9
0
 def test_mypy_package(self) -> None:
     run_mypy(['--config-file', 'mypy_self_check.ini', '-p', 'mypy'])