Hi all. We're trying to setup Pants in our compani...
# general
Hi all. We're trying to setup Pants in our companies extremely convoluted Python repo. So the repo currently consists of different micro-services each with its own PyProject.toml file (we are using Poetry) and then there is a main PyProject.toml file outside of the services folder which we use in our CI pipeline (running tests etc). For testing, instead of each service containing its own tests, all tests are located in a tests folder and are supposed to use the main PyProject.toml file. The issue is that when I try running ./pants test <path-to-test-file> it is unable to correctly identify a single root and gives an error like:
Copy code
The target lib/modules/serviceA/controller.py imports `sqlalchemy.text`, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['services/serviceA:poetry#SQLAlchemy', 'services/serviceB:poetry#SQLAlchemy', 'services/serviceC:poetry#SQLAlchemy'].
This is actually just a warning but ultimately it leads to an error like:
Copy code
ModuleNotFoundError: No module named 'flask_sqlalchemy'
I think somehow I need to specify that all tests need to use only the main PyProject.toml file but I'm not sure how I do that. Currently I'm setting my source as:
Copy code
marker_filenames = ["pyproject.toml"]
Please advise on how I can go about solving this problem. Thanks in advance.