From c953d5a2aec42b5489bce1d8907459ef1af42a18 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Sat, 6 Aug 2022 11:37:52 +0300 Subject: [PATCH] stubtest: Use `module_name` for error reporting --- mypy/stubtest.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index d517f6c53001f..2b828a2644ee6 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -116,10 +116,14 @@ def get_description(self, concise: bool = False) -> str: return _style(self.object_desc, bold=True) + " " + self.message stub_line = None - stub_file: None = None + stub_file = None if not isinstance(self.stub_object, Missing): stub_line = self.stub_object.line - # TODO: Find a way of getting the stub file + # TODO: find out how we can get filenames from other nodes: + if isinstance(self.stub_object, nodes.TypeInfo): + stub_file = os.path.abspath( + self.stub_object.module_name.replace(".", os.path.sep) + ".pyi" + ) stub_loc_str = "" if stub_line: