glamorous-nail-59544
12/21/2022, 7:35 PMrunserver
working. Next is to get my tests working.
So, any chance of getting my existing `APITestCase`s to run without a change?
Running ./pants run src/python/worker/manage.py -- test
results in 0 discovered tests.
If I specify the tests target ./pants run src/python/worker/manage.py -- test src/python/worker/app/tests
I get No module named 'worker.app.tests'
I checked both the django sample and the django webinar, but unfortunately this project is running using pytest, and my microservices are not. nevertheless I tried running ./pants test src/python/worker/app/tests/test_api.py
but I think it won't work out of the box, I got the following:
django.core.exceptions.ImproperlyConfigured: Requested setting REST_FRAMEWORK, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
What is is the shortest path to get my tests running?polite-garden-50641
12/21/2022, 7:38 PMstring_imports
under python-infer
option which will perhaps help pants infer deps from django strings used to specify python modules (apps, middleware, etc...)
https://www.pantsbuild.org/docs/reference-python-infer#string_importspolite-garden-50641
12/21/2022, 7:41 PMdependencies
goal to see which deps pants is able to infer.
For example ./pants dependencies src/python/worker/manage.py
or ``./pants dependencies src/python/worker/app/tests/test_api.py``polite-garden-50641
12/21/2022, 7:42 PM--dependencies-transitive
optionglamorous-nail-59544
12/21/2022, 7:50 PMstring_imports
is enabled
manage.py and tests/* don't have any dependency on each other. I tried to set some dependencies manually and got weird errors. Any recommendation?glamorous-nail-59544
12/21/2022, 7:53 PMpython_tests(
name="tests0",
dependencies=[
"src/python/worker:worker",
],
)
to my tests BUILD and now manage.py is showing as dependency, but still same DJANGO_SETTINGS_MODULE problemglamorous-nail-59544
12/21/2022, 8:31 PMtall-plastic-15186
12/31/2022, 7:47 PMglamorous-nail-59544
01/02/2023, 7:12 AM