10000 Make the test system marginally less hostile to external reuse (#10919) · python/mypy@3e5b9b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e5b9b1

Browse files
authored
Make the test system marginally less hostile to external reuse (#10919)
We currently assert that test-data is present in `mypy.test.config`; delay that until we actually do collection, so that things are at least importable.
1 parent 67a6ad7 commit 3e5b9b1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

mypy/test/config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
test_data_prefix = os.path.join(PREFIX, 'test-data', 'unit')
1212
package_path = os.path.join(PREFIX, 'test-data', 'packages')
1313

14-
assert os.path.isdir(test_data_prefix), \
15-
'Test data prefix ({}) not set correctly'.format(test_data_prefix)
16-
1714
# Temp directory used for the temp files created when running test cases.
1815
# This is *within* the tempfile.TemporaryDirectory that is chroot'ed per testcase.
1916
# It is also hard-coded in numerous places, so don't change it.

mypy/test/data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,10 @@ def collect(self) -> Iterator[pytest.Item]:
594594

595595
# obj is the object for which pytest_pycollect_makeitem returned self.
596596
suite: DataSuite = self.obj
597+
598+
assert os.path.isdir(suite.data_prefix), \
599+
'Test data prefix ({}) not set correctly'.format(suite.data_prefix)
600+
480E
597601
for f in suite.files:
598602
yield from split_test_cases(self, suite, os.path.join(suite.data_prefix, f))
599603

0 commit comments

Comments
 (0)
0