Skip to content

Commit

Permalink
[stubtest] associate exported symbol error with __all__ object_path (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Dec 1, 2022
1 parent 8da17d7 commit ceb976f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ def _verify_exported_names(
if not (names_in_runtime_not_stub or names_in_stub_not_runtime):
return
yield Error(
object_path,
object_path + ["__all__"],
(
"names exported from the stub do not correspond to the names exported at runtime. "
"This is probably due to an inaccurate `__all__` in the stub or things being missing from the stub."
"This is probably due to things being missing from the stub, or if present, an inaccurate `__all__` in the stub"
),
# Pass in MISSING instead of the stub and runtime objects, as the line numbers aren't very
# relevant here, and it makes for a prettier error message
Expand Down
4 changes: 2 additions & 2 deletions mypy/test/teststubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ def test_all_in_stub_not_at_runtime(self) -> Iterator[Case]:

@collect_cases
def test_all_in_stub_different_to_all_at_runtime(self) -> Iterator[Case]:
# We *should* emit an error with the module name itself,
# We *should* emit an error with the module name itself + __all__,
# if the stub *does* define __all__,
# but the stub's __all__ is inconsistent with the runtime's __all__
yield Case(
Expand All @@ -1040,7 +1040,7 @@ def test_all_in_stub_different_to_all_at_runtime(self) -> Iterator[Case]:
__all__ = []
foo = 'foo'
""",
error="",
error="__all__",
)

@collect_cases
Expand Down

0 comments on commit ceb976f

Please sign in to comment.