|
25 | 25 | VERSIONS_RE as VERSION_LINE_RE, |
26 | 26 | colored, |
27 | 27 | get_gitignore_spec, |
| 28 | + get_recursive_requirements, |
28 | 29 | print_error, |
29 | 30 | print_success_msg, |
30 | | - read_dependencies, |
31 | 31 | spec_matches_path, |
32 | 32 | strip_comments, |
33 | 33 | ) |
@@ -272,11 +272,19 @@ def add_third_party_files( |
272 | 272 | return |
273 | 273 | seen_dists.add(distribution) |
274 | 274 |
|
275 | | - dependencies = read_dependencies(distribution) |
| 275 | + stubs_dir = Path("stubs") |
| 276 | + dependencies = get_recursive_requirements(distribution) |
| 277 | + |
276 | 278 | for dependency in dependencies: |
277 | | - add_third_party_files(dependency, files, args, configurations, seen_dists) |
| 279 | + if dependency in seen_dists: |
| 280 | + continue |
| 281 | + seen_dists.add(dependency) |
| 282 | + files_to_add = sorted((stubs_dir / dependency).rglob("*.pyi")) |
| 283 | + files.extend(files_to_add) |
| 284 | + for file in files_to_add: |
| 285 | + log(args, file, f"included as a dependency of {distribution!r}") |
278 | 286 |
|
279 | | - root = Path("stubs", distribution) |
| 287 | + root = stubs_dir / distribution |
280 | 288 | for name in os.listdir(root): |
281 | 289 | if name.startswith("."): |
282 | 290 | continue |
@@ -348,9 +356,10 @@ def test_third_party_stubs(code: int, args: TestConfig) -> TestResults: |
348 | 356 | if spec_matches_path(gitignore_spec, distribution_path): |
349 | 357 | continue |
350 | 358 |
|
351 | | - this_code, checked = test_third_party_distribution(distribution, args) |
352 | | - code = max(code, this_code) |
353 | | - files_checked += checked |
| 359 | + if distribution_path in args.filter or any(distribution_path in path.parents for path in args.filter): |
| 360 | + this_code, checked = test_third_party_distribution(distribution, args) |
| 361 | + code = max(code, this_code) |
| 362 | + files_checked += checked |
354 | 363 |
|
355 | 364 | return TestResults(code, files_checked) |
356 | 365 |
|
|
0 commit comments