important-insurance-68329
09/03/2024, 2:14 PMwide-midnight-78598
09/03/2024, 2:15 PMpants test ::
?important-insurance-68329
09/03/2024, 2:16 PMwide-midnight-78598
09/03/2024, 2:17 PMwide-midnight-78598
09/03/2024, 2:19 PMchanged-since
(https://www.pantsbuild.org/2.21/docs/using-pants/advanced-target-selection#running-over-changed-files-with---changed-since), where you can limit the number of targets to run over.
Depending on your code, often this option is used alongside transitive dependencieswide-midnight-78598
09/03/2024, 2:19 PM❯ pants \
--changed-since=origin/main \
--changed-dependents=transitive \
test
important-insurance-68329
09/03/2024, 2:21 PMimportant-insurance-68329
09/03/2024, 2:21 PMwide-midnight-78598
09/03/2024, 2:22 PMimportant-insurance-68329
09/03/2024, 2:24 PMwide-midnight-78598
09/03/2024, 2:28 PMimportant-insurance-68329
09/03/2024, 2:31 PMwide-midnight-78598
09/03/2024, 2:34 PMwide-midnight-78598
09/03/2024, 2:35 PMimportant-insurance-68329
09/03/2024, 2:39 PM/src/services/service_a
and
/src/services/service_b
then tests in
/test/service_a
and
/test/service_b
but any change to a file in /src/services/service_a
that is not listed as a dependency to a given test file in /test/service_b
still triggers a re-run for that test file.wide-midnight-78598
09/03/2024, 2:46 PMwide-midnight-78598
09/03/2024, 2:48 PMfresh-cat-90827
09/03/2024, 2:53 PMimportlib
etc).
It's possible that you have weird dependency chains particularly if there are conftest.py
files involved.
I'd suggest dumping dependency graph into adjacency list with the JSON format https://www.pantsbuild.org/2.21/reference/goals/dependencies#formatfresh-cat-90827
09/03/2024, 2:53 PM--transitive
flag because this is how most of the nasty stuff is discovered!fresh-cat-90827
09/03/2024, 2:54 PMpaths
goal is very helpful as it will show you all the paths between two targets
$ pants paths --from=tests/cli/test_cli.py --to=cheeseshop/repository/package.py
[
[
"tests/cli/test_cli.py:tests",
"cheeseshop/cli/cli.py",
"cheeseshop/repository/package.py"
],
[
"tests/cli/test_cli.py:tests",
"cheeseshop/cli/cli.py",
"cheeseshop/repository/query.py",
"cheeseshop/repository/package.py"
],
[
"tests/cli/test_cli.py:tests",
"cheeseshop/cli/cli.py",
"cheeseshop/repository/repository.py",
"cheeseshop/repository/package.py"
]
]
important-insurance-68329
09/03/2024, 3:03 PM/test/service_b
test file and a file from /src/services/service_a
🤯important-insurance-68329
09/03/2024, 3:07 PMwide-midnight-78598
09/03/2024, 3:12 PMimportant-insurance-68329
09/03/2024, 3:14 PM