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

fresh-cat-90827

01/18/2023, 4:51 PM
Does Pants provide OOTB support for declaring dependencies recursively for a directory? 🧵
Say I have
Copy code
tests
  BUILD
  - A
     - BUILD
     - test_m1.py
  - B
     - BUILD
     - test_m2.py
if I want to run all tests under the
tests
directory when there's a change to a particular target in the sources, do I need to update every
python_tests
target recursively in the
tests
(or create a macro that would declare that dependency) or is there a way to do this somehow from the
tests/BUILD
only? It would have been possible to use a recursive pattern in the
python_tests
(e.g.
sources=["*/**/test_*.py"]
, but because there is a
BUILD
file in each directory, the tests are already owned.
c

curved-television-6568

01/18/2023, 5:09 PM
If you don’t otherwise are using the dependencies field on you
python_tests
targets, you may get away with
Copy code
__defaults__({python_tests: dict(dependencies=["src/proj/file.py"])})