diff --git a/mypy/test/data.py b/mypy/test/data.py index 726076e0c726..30e4ef95adc8 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -314,6 +314,19 @@ def runtest(self) -> None: # TODO: add a better error message for when someone uses skip and xfail at the same time elif self.xfail: self.add_marker(pytest.mark.xfail) + + if ( + not [line for line in self.input if line.strip()] + and "Empty" not in self.name + and not [ + file + for file in self.files + # these files are added based on other things + if os.path.basename(file[0]) not in ("typing.pyi", "_typeshed.pyi", "builtins.pyi") + ] + ): + raise AssertionError(f"{self.name} is empty.") + parent = self.getparent(DataSuiteCollector) assert parent is not None, "Should not happen" suite = parent.obj()