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

strong-toothbrush-37759

03/22/2022, 7:43 PM
Can somebody give me a hint on how to generate a pytest lockfile with specific versions of dependencies? We’re using some plugins for pytest & django (i.e.
pytest-django
) which are loaded when pytest starts. When I generate a lockfile using
./pants generate-lockfile
I get
pytest-django==3.10.0
but
pytest-django==4.1.0
is what I need and what is written in our
requirements-dev.txt
actually 🤔
1
b

bitter-ability-32190

03/22/2022, 7:47 PM
s

strong-toothbrush-37759

03/22/2022, 7:49 PM
Thank you, I guess so 🤔 do you mean
extra_requirements
for the
pants.toml
is the correct place?
1
r

rapid-crayon-8232

03/22/2022, 7:49 PM
There are 2 ways to have what you want: • in
pants.toml
add the extra requirements you want for pytest:
Copy code
[pytest]
version = "pytest>=7.0,<8.0"
args = ["-ra -q -vv --no-header"]
extra_requirements.add = ["pytest-icdiff", "pygments", "pytest-django==4.10.0"]
lockfile = "monorepo/build-support/lockfiles/pytest.txt"
• or simply add
pytest-django
(added in
requirements.txt
) as a dependency to you
python_test
target
s

strong-toothbrush-37759

03/22/2022, 7:50 PM
Thanks you two, I tried the latter which didn’t work. That’s why I was asking. Thanks! 🙏
It works, awesome! 🙌
Thanks again @rapid-crayon-8232 & @bitter-ability-32190
🙌 1
2 Views