```root L config L settings L test.py L proj...
# general
c
Copy code
root
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
Copy code
python_sources(
    name="lib",
    dependencies=[
        "config",
    ]
)

python_tests(
    name="tests",
    dependencies=[
        ":lib",
    ],
)
Errors
Copy code
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'
r
Copy code
python_sources(
    name="lib",
    dependencies=[
        "config",
    ]
)
should be, in order to make this work.
Copy code
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.
👍 1
c
Thanks @refined-addition-53644 Do you the way I can apply to all of tests? Or do I have to apply one by one?
r
If all of your tests live inside the
project/app/tests
, then this should work without applying one by one.
👏 1