lemon-helicopter-73409
03/08/2023, 4:55 PMImportError: No module named 'config.settings'
pytest-django could not find a Django project (no manage.py file could be found). You must explicitly add your Django project to the Python path to have it picked up.
Here is the repo in question: https://github.com/xuru/monolith-to-monorepo/tree/pants_baseline
If anyone could give me some pointers on how to make this work, I would much appreciate it!refined-addition-53644
03/08/2023, 5:01 PMlemon-helicopter-73409
03/08/2023, 5:02 PMrefined-addition-53644
03/08/2023, 5:04 PMlemon-helicopter-73409
03/08/2023, 5:07 PMrefined-addition-53644
03/08/2023, 5:08 PMlemon-helicopter-73409
03/08/2023, 5:09 PMrefined-addition-53644
03/08/2023, 5:12 PMlemon-helicopter-73409
03/08/2023, 5:13 PM✕ mtom/api/tests/pagination/test_get_paginated_response.py:../../../tests failed in 4.12s.
✕ mtom/authentication/tests/apis/test_user_login.py:../../../tests failed in 4.36s.
✕ mtom/common/tests/models/test_random_model.py:../../../tests failed in 4.13s.
✕ mtom/common/tests/services/test_model_update.py:../../../tests failed in 4.48s.
✕ mtom/common/tests/utils/test_inline_serializer.py:../../../tests failed in 4.50s.
✕ mtom/files/tests/flows/test_direct_upload.py:../../../tests failed in 4.48s.
✕ mtom/files/tests/flows/test_standard_upload.py:../../../tests failed in 4.50s.
✕ mtom/testing_examples/tests/selectors/test_school_list_school_courses.py:../../../tests failed in 4.46s.
✕ mtom/testing_examples/tests/services/test_roster_create.py:../../../tests failed in 4.48s.
✕ mtom/testing_examples/tests/services/test_roster_validate_period.py:../../../tests failed in 4.12s.
✕ mtom/testing_examples/tests/services/test_student_create.py:../../../tests failed in 4.36s.
✕ mtom/users/tests/services/test_user_create.py:../../../tests failed in 4.10s.
If that helpsrefined-addition-53644
03/08/2023, 5:14 PMpython_tests
target for this? I don’t see it inside these directorieslemon-helicopter-73409
03/08/2023, 5:14 PMmtom/BUILD
refined-addition-53644
03/08/2023, 5:17 PMpython_sources
for motm
has no glob like pattern you use for python_tests
inside dependencies
?lemon-helicopter-73409
03/08/2023, 5:17 PMrefined-addition-53644
03/08/2023, 5:19 PMpython_sources
only globs by default the .py
files inside current directory but nothing beyond thatlemon-helicopter-73409
03/08/2023, 5:19 PMpython_tests
?refined-addition-53644
03/08/2023, 5:19 PMpython_sources
in every directory or you need to glob it. But ensure that only non test files are part of python_sources
. By the way you need use sources
for that, not dependencieslemon-helicopter-73409
03/08/2023, 5:22 PMrefined-addition-53644
03/08/2023, 5:24 PMskip_mypy
etc.lemon-helicopter-73409
03/08/2023, 5:25 PMrefined-addition-53644
03/08/2023, 5:26 PM!test_*.py
inside the python sources. Of course this would have to cover all the tests file in current and directories below
Check the docs for example
https://www.pantsbuild.org/docs/reference-python_sources#codesourcescode
Pants will otherwise complain that there are multiple owners.lemon-helicopter-73409
03/08/2023, 5:38 PMpython_sources(
dependencies=[
"//:req",
"config:config", # For settings.py.
],
sources=['*.py', '**/*.py', '!test_*.py', '!conftest.py']
)
refined-addition-53644
03/08/2023, 5:40 PMconfig
BUILD file too.lemon-helicopter-73409
03/08/2023, 5:40 PMrefined-addition-53644
03/08/2023, 5:45 PMsources=["**/*.py", "!**/test_*.py", "!**/conftest.py"]
//:req
dependencies. Pants will figure out all this stuff on its own as long as you have poetry_requirements
when using poetrylemon-helicopter-73409
03/08/2023, 5:49 PMrefined-addition-53644
03/08/2023, 5:50 PMconfig:config
isn’t required. Most of the time pants figures out all such dependencies based on your import statement.lemon-helicopter-73409
03/08/2023, 5:50 PM