quaint-telephone-89068
12/05/2022, 11:38 PM$ cp helloworld/translator/translator_test.py helloworld/translator/translator_another_test.py
$ ./pants dependencies helloworld/translator/translator_test.py
//:reqs#pytest
helloworld/translator/translator.py:lib
$ PANTS_PYTHON_INFER_IMPORTS=False ./pants dependencies helloworld/translator/translator_test.py
helloworld/translator/translator_another_test.py:tests
The current behavior reports translator_another_test.py to be a dependency of helloworld/translator/translator_test.py, but it's clearly not:
$ ./pants paths --to=helloworld/translator/translator_test.py --from=helloworld/translator/translator_another_test.py
[]
It may make sense to have this behavior enabled for python_sources, but for python_tests this may make less sense as the tests are run independent of each other and normally do not import from each other.
For instance, listing dependencies when having changes in a particular test module (with dependency inference disabled), shouldn't list all test modules:
./pants --changed-since=HEAD --changed-dependees=direct \
--filter-target-type=python_test list
Describe the solution you'd like
Perhaps it would be better to have an option to disable this behavior; this may be useful in case a user has an own dependency inference implementation and they would like to ignore the builtin one. An advanced option in the python-infer may be sensible.
pantsbuild/pants