From 57faa02b0ba0f5ce7df4f16e96ddd7f231a4f26e Mon Sep 17 00:00:00 2001 From: Stu Hood Date: Fri, 22 Jul 2022 21:37:31 -0700 Subject: [PATCH 1/2] Enable `unowned_dependency_behavior="warning"` by default. # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] --- src/python/pants/backend/python/dependency_inference/rules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/pants/backend/python/dependency_inference/rules.py b/src/python/pants/backend/python/dependency_inference/rules.py index bbbe346263b..25ea0840e70 100644 --- a/src/python/pants/backend/python/dependency_inference/rules.py +++ b/src/python/pants/backend/python/dependency_inference/rules.py @@ -180,7 +180,7 @@ class PythonInferSubsystem(Subsystem): ), ) unowned_dependency_behavior = EnumOption( - default=UnownedDependencyUsage.DoNothing, + default=UnownedDependencyUsage.LogWarning, help=softwrap( """ How to handle imports that don't have an inferrable owner. From ac57a9d29f2d9579e9c59f5971b5cc293803be20 Mon Sep 17 00:00:00 2001 From: Stu Hood Date: Sun, 24 Jul 2022 14:38:45 -0700 Subject: [PATCH 2/2] Fix test. # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels] --- .../pants/backend/python/dependency_inference/rules_test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/python/pants/backend/python/dependency_inference/rules_test.py b/src/python/pants/backend/python/dependency_inference/rules_test.py index b2fe218b08e..1438a04c006 100644 --- a/src/python/pants/backend/python/dependency_inference/rules_test.py +++ b/src/python/pants/backend/python/dependency_inference/rules_test.py @@ -95,7 +95,10 @@ def test_infer_python_imports(caplog) -> None: def run_dep_inference( address: Address, *, enable_string_imports: bool = False ) -> InferredDependencies: - args = ["--source-root-patterns=src/python"] + args = [ + "--source-root-patterns=src/python", + "--python-infer-unowned-dependency-behavior=ignore", + ] if enable_string_imports: args.append("--python-infer-string-imports") rule_runner.set_options(args, env_inherit={"PATH", "PYENV_ROOT", "HOME"})