Skip to content

Commit 43b0f96

Browse files
committed
move stubgen to pytest
1 parent 7018ca0 commit 43b0f96

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

mypy/test/teststubgen.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from mypy.myunit import Suite, AssertionFailure, assert_equal
1515
from mypy.test.helpers import assert_string_arrays_equal
16-
from mypy.test.data import parse_test_cases, DataDrivenTestCase
16+
from mypy.test.data import DataSuite, parse_test_cases, DataDrivenTestCase
1717
from mypy.test import config
1818
from mypy.parse import parse
1919
from mypy.errors import CompileError
@@ -95,15 +95,19 @@ def test_infer_sig_from_docstring(self) -> None:
9595
assert_equal(infer_sig_from_docstring('\nfunc x', 'func'), None)
9696

9797

98-
class StubgenPythonSuite(Suite):
98+
class StubgenPythonSuite(DataSuite):
9999
test_data_files = ['stubgen.test']
100100

101-
def cases(self) -> List[DataDrivenTestCase]:
101+
@classmethod
102+
def cases(cls) -> List[DataDrivenTestCase]:
102103
c = [] # type: List[DataDrivenTestCase]
103-
for path in self.test_data_files:
104+
for path in cls.test_data_files:
104105
c += parse_test_cases(os.path.join(config.test_data_prefix, path), test_stubgen)
105106
return c
106107

108+
def run_case(self, testcase: DataDrivenTestCase) -> None:
109+
test_stubgen(testcase)
110+
107111

108112
def parse_flags(program_text: str) -> Options:
109113
flags = re.search('# flags: (.*)$', program_text, flags=re.MULTILINE)

runtests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@ def test_path(*names: str):
212212
'testparse',
213213
'testsemanal',
214214
'testpythoneval',
215-
'testcmdline'
215+
'testcmdline',
216+
'teststubgen'
216217
)
217218

218219
MYUNIT_FILES = test_path(
219-
'teststubgen', # contains data-driven suite
220-
220+
'teststubgen',
221221
'testargs',
222222
'testgraph',
223223
'testinfer',

0 commit comments

Comments
 (0)