Hello community, I am currently upgrading from 2.6...
# general
b
Hello community, I am currently upgrading from 2.6.1 to 2.16.0 I get this while running ./pants test :: :
Copy code
If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see <https://www.pantsbuild.org/v2.16/docs/troubleshooting#import-errors-and-missing-dependencies> for common problems.

 * tests.python.config_mock (line: 10)
I have a BUILD file in the tests/python folder with the following:
Copy code
python_sources(
  name = "config-mock.lib",
  sources = ['config_mock.py'],
)
And referred it into the tests' subfolder BUILD file dependency with
Copy code
"tests/python:config-mock.lib"
All works fine but i get that warning and i don't know how to handle it.
1
c
I miss some details from the error message, there should be details about two modules/targets (the origin and the dependency target/import)
b
tests/python/env_validation_tests/checks/test_iops.py../env validation.tests
one of many
c
ok, so I guess they import the
config_mock.py
file in some way? can you share one such import line..
b
Copy code
from tests.python import config_mock
c
and what is the output of
pants roots
?
b
Copy code
3rdparty/python
pants-plugins/src
src/python
tests/python
c
so, your import should be just
import config_mock
as the prefix you have is not part of the import path, it’s being stripped as outside a source root
b
i will try it and let you know, thanks for your help
c
you’re welcome 🙂
with that fix in place, you would no longer need the hardcoded dependency you have with “And referred it into the tests’ subfolder BUILD file dependency with …”
b
i will remove it then, it seems to have fixed it
thanks a lot
👍 1
c
for your, and our, record, this was covered by the docs linked in the error message (did you try that first but failed? asking in order to see if we may need to improve the docs)
b
i read it but had no clue that was it
1