forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve
help
and error message for `[python-infer].unowned_dependen…
…cy_behavior` (Cherry-pick of pantsbuild#15334) This mostly points at https://www.pantsbuild.org/v2.11/docs/troubleshooting#import-errors-and-missing-dependencies because we decided it was too noisy of a warning/error message to reproduce the whole guide. We want the terminal to highlight diagnostics unique to the particular issue, and leave general guidance elsewhere. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` Closes pantsbuild#15326 by improving the error message when resolves are likely the culprit. ``` UnownedDependencyError: Pants cannot infer owners for the following imports from the target src/python/pants/util/strutil_test.py:tests: * pants.util.strutil.bullet_list (line: 9) * pants.util.strutil.ensure_binary (line: 10) ... * pants.util.strutil.strip_prefix (line: 18) * pants.util.strutil.strip_v2_chroot_path (line: 19) * pytest (line: 6) These imports are not in the resolve used by the target (`another`), but they were present in other resolves: * pants.util.strutil.bullet_list: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_binary: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.ensure_text: 'python-default' from src/python/pants/util/strutil.py * pants.util.strutil.first_paragraph: 'python-default' from src/python/pants/util/strutil.py ... * pytest: 'python-default' from 3rdparty/python#pytest If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see https://www.pantsbuild.org/v2.12/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. ``` [ci skip-rust] # Conflicts: # src/python/pants/backend/python/dependency_inference/rules.py # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
- Loading branch information
1 parent
1e8c10d
commit 7acbd9a
Showing
2 changed files
with
198 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.