curved-farmer-66180
07/31/2022, 5:42 PMroot
L config
L settings
L test.py
L projects
L app
L tests
L test_app.py
To test test_app.py, I need to add pytest config file to config.settings.test, but test couldn’t get the location. Anyone can help me?
BUILD file
python_sources(
name="lib",
dependencies=[
"config",
]
)
python_tests(
name="tests",
dependencies=[
":lib",
],
)
Errors
File "/Users/szto/.cache/pants/named_caches/pex_root/venvs/s/a852a762/venv/lib/python3.7/site-packages/pytest_django/plugin.py", line 183, in _handle_import_error
raise ImportError(msg)
ImportError: No module named 'config.settings.test'
refined-addition-53644
07/31/2022, 6:03 PMpython_sources(
name="lib",
dependencies=[
"config",
]
)
should be, in order to make this work.
python_sources(
name="lib",
sources=[
"config/**/*.py",
]
)
dependencies
are dependency on a pants defined target. So unless you have a target generated under config, the way you wrote won’t work.curved-farmer-66180
08/01/2022, 2:08 AMrefined-addition-53644
08/01/2022, 5:56 AMproject/app/tests
, then this should work without applying one by one.