Skip to content

Commit 733077c

Browse files
committed
[mypyc] Disable the typechecking and flake8 tests
1 parent 1992b67 commit 733077c

File tree

2 files changed

+0
-81
lines changed

2 files changed

+0
-81
lines changed

mypy.ini

Lines changed: 0 additions & 16 deletions
This file was deleted.

mypyc/test/test_external.py

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -45,68 +45,3 @@ def test_c_unit_test(self) -> None:
4545
cwd=os.path.join(base_dir, 'mypyc', 'lib-rt'))
4646
if status != 0:
4747
raise AssertionError("make test: C unit test failure")
48-
49-
def test_self_type_check(self) -> None:
50-
"""Use the bundled mypy (in git submodule) to type check mypyc."""
51-
mypy_dir = os.path.join(base_dir, 'mypyc', 'external', 'mypy')
52-
if not os.path.exists(os.path.join(mypy_dir, 'mypy', 'typeshed', 'stdlib')):
53-
raise AssertionError('Submodule mypy/mypy/typeshed not ready')
54-
env = os.environ.copy()
55-
env['PYTHONPATH'] = mypy_dir
56-
env['MYPYPATH'] = os.pathsep.join((mypy_dir, base_dir))
57-
status = subprocess.call(
58-
[sys.executable,
59-
'-m', 'mypy',
60-
'--config-file', 'mypy.ini', '-p', 'mypyc'],
61-
env=env)
62-
if status != 0:
63-
raise AssertionError("Self type check failure")
64-
65-
def test_flake8(self) -> None:
66-
"""Use flake8 to lint mypyc."""
67-
status = cached_flake8('mypyc')
68-
if status != 0:
69-
assert False, "Lint failure"
70-
71-
72-
CACHE_FILE = '.mypyc-flake8-cache.json'
73-
74-
75-
def cached_flake8(dir: str) -> int:
76-
"""Run flake8 with cached results from the previous clean run.
77-
78-
Record the hashes of files after a clean run and don't pass the files to
79-
flake8 if they have the same hashes, as they are expected to produce a
80-
clean output.
81-
82-
If flake8 settings or version change, the cache file may need to be manually
83-
removed.
84-
"""
85-
import hashlib
86-
import glob
87-
import json
88-
89-
if os.path.isfile(CACHE_FILE):
90-
with open(CACHE_FILE) as f:
91-
cache = json.load(f)
92-
else:
93-
cache = {}
94-
files = glob.glob('%s/**/*.py' % dir, recursive=True)
95-
files = [f for f in files if not f.startswith(os.path.join(dir, 'external', 'mypy'))]
96-
hashes = {}
97-
for fn in files:
98-
with open(fn, 'rb') as fb:
99-
data = fb.read()
100-
hashes[fn] = hashlib.sha1(data).hexdigest()
101-
filtered = [fn for fn in files
102-
if hashes[fn] != cache.get(fn)]
103-
if not filtered:
104-
# Nothing has changed since the previous clean run -- must be clean.
105-
return 0
106-
status = subprocess.call([sys.executable, '-m', 'flake8'] + filtered)
107-
if status == 0:
108-
for fn, sha in hashes.items():
109-
cache[fn] = sha
110-
with open(CACHE_FILE, 'w') as f:
111-
json.dump(cache, f, indent=4)
112-
return status

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy