| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Fixed the Windows-only test expectation in 7d71289 by accepting both POSIX and drive-prefixed Windows separators. I also folded pre-commit.ci’s import-spacing auto-fix into the authored commit, preserving single-commit history. The focused 10-test suite passed before the formatting-only bot change; the final tree passes Ruff, ruff format, py_compile, and git diff --check. CI is rerunning. |
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm & should fix my issue. thanks for implementing that so fast ❤️
now only a maintainer decision is required for this change
Sorry, something went wrong.
| mod = os.path.basename(path) if options.scripts_are_modules else None | ||
| sources.append(BuildSource(path, mod, None)) | ||
| if not sources and empty_dirs: | ||
| raise InvalidSourceList(f"There are no .py[i] files in directory '{empty_dirs[0]}'") |
There was a problem hiding this comment.
Because multiple dirs can be supplied & the error now only occurs when all dirs are "empty", I would just list all dirs in the error:
| raise InvalidSourceList(f"There are no .py[i] files in directory '{empty_dirs[0]}'") | |
| empty_dirs_str = ", ".join(map(repr, empty_dirs)) | |
| raise InvalidSourceList(f"There are no .py[i] files in directories: {empty_dirs_str}") |
(and then also improve the escaping of the path strings, some Linux users have e.g. ' in their paths xD)
EDIT: This suggestion requires a small adaption on the test, because the message no longer matches because I used the plural directories.
Sorry, something went wrong.
There was a problem hiding this comment.
Addressed in 1ed6ecf. create_source_list now reports every empty directory using repr, so paths containing quotes are escaped unambiguously. The regression covers two empty directories (including a quoted path). Validation passed: TMPDIR=/tmp .venv/bin/python -m pytest -n0 mypy/test/test_find_sources.py -q (10 passed), .venv/bin/python runtests.py lint, and git diff --check.
Sorry, something went wrong.
|
Thanks for confirming the fix works for your issue and for the approval! |
Sorry, something went wrong.
|
Diff from mypy_primer, showing the effect of this PR on open source code: scipy-stubs (https://github.com/scipy/scipy-stubs)
- tests/misc/test_submodules_empty.pyi:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #22173
create_source_list now defers the existing empty-directory error until all explicit targets have been scanned. This lets mypy check valid targets alongside an empty directory while preserving the fatal error when no sources are found.
A regression test covers both the mixed-target and all-empty cases.
Validation:
AI assistance: Codex helped draft the focused change and test; I reviewed the diff and ran all validation locally.