https://pantsbuild.org/ logo
#general
Title
# general
h

hundreds-carpet-28072

04/26/2023, 3:53 PM
Now that
unowned_dependency_behaviour
(link) = WARN by default, how should we be setting the owner for
pytest
?
pytest
is pinned outside of
requirements.txt
in a different file. Can I point to this file in config somewhere?
f

future-oxygen-10553

04/26/2023, 4:53 PM
It depends a little bit which version of pants you’re using. 2.15 and below, you can do this: https://www.pantsbuild.org/docs/python-test-goal#pytest-version-and-plugins In 2.16.rc0 and newer, you can do: https://www.pantsbuild.org/v2.16/docs/python-lockfiles#lockfiles-for-tools
h

hundreds-carpet-28072

04/27/2023, 9:31 AM
@future-oxygen-10553 So I actually already do this, see here:
Copy code
[pytest]
version = "pytest==6.2.4"
extra_requirements = [
  "pytest-icdiff==0.5",
  "pygments==2.9.0",
  "pyfakefs==4.5.1",
  "pytest-cov==2.12.1",
  "pytest-mock==3.10.0",
]
lockfile = "<none>"
Still getting
unowned_inferred_dependencies
warning for pytest and friends. Any clue?
f

future-oxygen-10553

04/27/2023, 3:21 PM
I think if there are any dependencies that you import to your tests, you have to have those in a
python_requirement
somehow, whether that’s in a
requirements.txt
or directly in the
BUILD
file. However, if you want to single-source the version, I think you can point
pants.toml
to the lockfile where you’ve specified pytest and these other dependencies? I’m more familiar with the 2.16 style, where things “just work” ™️
Sorry I can’t be more help
h

hundreds-carpet-28072

04/27/2023, 3:38 PM
Okay thanks Brian. We landed on a solution for now 👍