Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we need "# pants: no-infer-dep" if we import pytest in all test codes #17481

Closed
kamioka-masaya opened this issue Nov 7, 2022 · 1 comment
Labels

Comments

@kamioka-masaya
Copy link

Describe the bug
After upgrading from 2.12.0 to 2.14.0 and running the test, the following warning logs were output in large quantities.

04:16:15.25 [WARN] Pants cannot infer owners for the following imports in the target src/python/xxx.py:hoge:

  * 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.14/docs/troubleshooting#import-errors-and-missing-dependencies for common problems.

Pants version
2.14.0

OS
MacOS, Linux

@thejcannon
Copy link
Member

In Pants 2.14.x the default for https://www.pantsbuild.org/docs/reference-python-infer#unowned_dependency_behavior changed to warning.

The issue is at it's core #12449, but you have a few options:

  • Add pytest to your default resolve's requirements (and try and keep the versions the same)
  • Downgrade that option back to ignore
  • Ignore the warning

@thejcannon thejcannon closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants