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

rhythmic-morning-87313

04/29/2022, 2:46 PM
Q9: what's the purpose of
python_test_utils
and how does it interact with
python_tests
?
2
r

refined-addition-53644

04/29/2022, 2:47 PM
r

rhythmic-morning-87313

04/29/2022, 2:47 PM
is it possible to add other utility modules under the tests directory to be used with tests?
(which are not tests by themselves)
b

bitter-ability-32190

04/29/2022, 2:47 PM
conftests
are funny because they aren't your natural python sources, but they also aren't tests themselves... therefore they gettheir own special target
is it possible to add other utility modules under the tests directory to be used with tests?
Anything is possible. Pants is just built with some conventions in mind, but you are welcome to override/amend the defaults as you need to
r

rhythmic-morning-87313

04/29/2022, 2:49 PM
ahha
i got it
🙌 2
👖 1
1
now the test runs
b

bitter-ability-32190

04/29/2022, 2:50 PM
Always a great feeling 😉
🙏 1
r

rhythmic-morning-87313

04/29/2022, 2:50 PM
image.png
so the missing pieces were
//:reqs
dependency in
python_sources
and
redis/*.py
with
!redis/test_*.py
to specify test utility modules
it is interesting that it runs pytest modules one-by-one to parallelize
do i need to specify this line? it works same with/without the line.
r

refined-addition-53644

04/29/2022, 2:56 PM
you can try removing it and running the test 😉
r

rhythmic-morning-87313

04/29/2022, 2:57 PM
it works without it, so i think pants automatically assumes
python_tests
relies on
python_test_utils
in the same BUILD file
👍 1
though I'd prefer explicity
5 Views