Skip to content

Commit 91f532e

Browse files
elazarggvanrossum
authored andcommitted
remove handling of @include in testsuites (#5076)
This is very old code, and I couldn't find any hint of it doing anything.
1 parent eaa16f3 commit 91f532e

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

mypy/test/data.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def parse_test_cases(parent: 'DataSuiteCollector', suite: 'DataSuite',
4141
join = os.path.join
4242
else:
4343
join = posixpath.join # type: ignore
44-
include_path = os.path.dirname(path)
4544
with open(path, encoding='utf-8') as f:
4645
lst = f.readlines()
4746
for i in range(len(lst)):
@@ -166,7 +165,7 @@ def parse_test_cases(parent: 'DataSuiteCollector', suite: 'DataSuite',
166165
ok = True
167166

168167
if ok:
169-
input = expand_includes(p[i0].data, include_path)
168+
input = p[i0].data
170169
expand_errors(input, tcout, 'main')
171170
for file_path, contents in files:
172171
expand_errors(contents.split('\n'), tcout, file_path)
@@ -505,24 +504,6 @@ def collapse_line_continuation(l: List[str]) -> List[str]:
505504
return r
506505

507506

508-
def expand_includes(a: List[str], base_path: str) -> List[str]:
509-
"""Expand @includes within a list of lines.
510-
511-
Replace all lies starting with @include with the contents of the
512-
file name following the prefix. Look for the files in base_path.
513-
"""
514-
515-
res = [] # type: List[str]
516-
for s in a:
517-
if s.startswith('@include '):
518-
fn = s.split(' ', 1)[1].strip()
519-
with open(os.path.join(base_path, fn)) as f:
520-
res.extend(f.readlines())
521-
else:
522-
res.append(s)
523-
return res
524-
525-
526507
def expand_variables(s: str) -> str:
527508
return s.replace('<ROOT>', root_dir)
528509

0 commit comments

Comments
 (0)