From 778dbec8161bd52ac63dcd84353c087b73496b33 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Thu, 24 Oct 2024 22:43:40 -0700 Subject: [PATCH] workaround regression for now --- mypy/modulefinder.py | 5 ++--- test-data/unit/check-modules.test | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mypy/modulefinder.py b/mypy/modulefinder.py index fee484ae02fb..3b6e1a874d37 100644 --- a/mypy/modulefinder.py +++ b/mypy/modulefinder.py @@ -554,10 +554,9 @@ def _find_module(self, id: str, use_typeshed: bool) -> ModuleSearchResult: if approved_stub_package_exists(id): return ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED - elif found_possible_third_party_missing_type_hints: + if found_possible_third_party_missing_type_hints: return ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS - else: - return ModuleNotFoundReason.NOT_FOUND + return ModuleNotFoundReason.NOT_FOUND def find_modules_recursive(self, module: str) -> list[BuildSource]: module_path = self.find_module(module, fast_path=True) diff --git a/test-data/unit/check-modules.test b/test-data/unit/check-modules.test index 5fd48577e436..f368f244eb34 100644 --- a/test-data/unit/check-modules.test +++ b/test-data/unit/check-modules.test @@ -3146,8 +3146,13 @@ main:1: note: (or run "mypy --install-types" to install all missing stub package main:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports main:2: error: Library stubs not installed for "bleach.abc" -[case testMissingSubmoduleOfInstalledStubPackageIgnored] +[case testMissingSubmoduleOfInstalledStubPackageIgnored-xfail] # flags: --ignore-missing-imports + +# TODO: testMissingSubmoduleOfInstalledStubPackageIgnored was regressed in +# https://github.com/python/mypy/pull/15347 but didn't cause failures because we don't have a +# package path in this unit test + import bleach.xyz from bleach.abc import fgh [file bleach/__init__.pyi]