From e22e6bf691e329503e0c02354d54041bf37fe7f5 Mon Sep 17 00:00:00 2001 From: Elazar Gershuni Date: Fri, 18 May 2018 03:22:25 +0300 Subject: [PATCH] remove handling of @include in testsuites --- mypy/test/data.py | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/mypy/test/data.py b/mypy/test/data.py index 08234e384502..ad6b2bc08f5c 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -41,7 +41,6 @@ def parse_test_cases(parent: 'DataSuiteCollector', suite: 'DataSuite', join = os.path.join else: join = posixpath.join # type: ignore - include_path = os.path.dirname(path) with open(path, encoding='utf-8') as f: lst = f.readlines() for i in range(len(lst)): @@ -166,7 +165,7 @@ def parse_test_cases(parent: 'DataSuiteCollector', suite: 'DataSuite', ok = True if ok: - input = expand_includes(p[i0].data, include_path) + input = p[i0].data expand_errors(input, tcout, 'main') for file_path, contents in files: expand_errors(contents.split('\n'), tcout, file_path) @@ -505,24 +504,6 @@ def collapse_line_continuation(l: List[str]) -> List[str]: return r -def expand_includes(a: List[str], base_path: str) -> List[str]: - """Expand @includes within a list of lines. - - Replace all lies starting with @include with the contents of the - file name following the prefix. Look for the files in base_path. - """ - - res = [] # type: List[str] - for s in a: - if s.startswith('@include '): - fn = s.split(' ', 1)[1].strip() - with open(os.path.join(base_path, fn)) as f: - res.extend(f.readlines()) - else: - res.append(s) - return res - - def expand_variables(s: str) -> str: return s.replace('', root_dir)