From 14b06ae672f0ba0f4f6e4d9c71702222d42ab832 Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 6 Mar 2023 13:23:07 -0500 Subject: [PATCH] pytype_test.py: Fix typechecking errors following #9747 (#9849) --- requirements-tests.txt | 2 +- tests/pytype_test.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/requirements-tests.txt b/requirements-tests.txt index c8dab9528..f7faf5506 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -16,5 +16,5 @@ termcolor>=2 tomli==2.0.1 tomlkit==0.11.6 types-pyyaml>=6.0.12.7 -types-setuptools +types-setuptools>=67.5.0.0 typing-extensions diff --git a/tests/pytype_test.py b/tests/pytype_test.py index b24d7cb79..4d7a1f888 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -159,12 +159,10 @@ def get_missing_modules(files_to_test: Sequence[str]) -> Iterable[str]: missing_modules = set() for distribution in stub_distributions: for pkg in read_dependencies(distribution).external_pkgs: + egg_info = pkg_resources.get_distribution(pkg).egg_info + assert isinstance(egg_info, str) # See https://stackoverflow.com/a/54853084 - top_level_file = os.path.join( - # Fixed in #9747 - pkg_resources.get_distribution(pkg).egg_info, # type: ignore[attr-defined] # pyright: ignore[reportGeneralTypeIssues] - "top_level.txt", - ) + top_level_file = os.path.join(egg_info, "top_level.txt") with open(top_level_file) as f: missing_modules.update(f.read().splitlines()) return missing_modules