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

modern-wolf-36228

12/08/2021, 1:18 PM
How do I change the setup so pants can only recognize tests if
test_*.py
? I don't want
*_test.py
๐Ÿ˜—
c

curved-television-6568

12/08/2021, 1:28 PM
There is no configuration knob for changing the default, so youโ€™d either have to use a macro/custom target, or override it everywhere, I think.
You can exclude certain files, though.. using a
"!file_test.py"
syntax..
(the double exclam syntax is for something else, I donโ€™t recall at the moment..)
m

modern-wolf-36228

12/08/2021, 1:33 PM
So nothing available for global level?
c

curved-television-6568

12/08/2021, 1:35 PM
Nope, but this has come up before, perhaps you have a compelling use case for a feature request for a global option to support tweaking the default source globs for targets.
m

modern-wolf-36228

12/08/2021, 1:37 PM
yeah, not having tailor add the
python_tests()
on those
would you say that is compelling enough? ๐Ÿค”
๐Ÿคฃ 1
๐Ÿ‘ˆ 1
๐Ÿ‘€ 1
c

curved-television-6568

12/08/2021, 1:39 PM
Interesting thing is that a macro wouldnโ€™t help for that.. so yeah.. could be (looking into tailor a bit..) ๐Ÿ™‚ ๐Ÿ˜„
There is options for tailor to ignore paths and/or targets. https://www.pantsbuild.org/v2.9/docs/reference-tailor#section-ignore-paths Perhaps it would be enough to run tailor with an ignore for
*_test.py
files?
๐Ÿ‘ 1
m

modern-wolf-36228

12/08/2021, 1:42 PM
let me test
it works to avoid the python_tests()... but it will not add the pex_binary if I have a
if ___name___...
but works for me
๐Ÿ‘ 1
c

curved-television-6568

12/08/2021, 1:52 PM
OK ๐Ÿ™‚
m

modern-wolf-36228

12/08/2021, 1:54 PM
thanks ๐Ÿ‘
2 Views