Closed mh-firouzjah closed 1 year ago
the idea is to check if an auto-generated manage.py
exists in the rootfolder
and by auto-generated I mean it is generated by django-admin startproject
command.
existence of such a file has two messages, first this is a django project and not a pure python project so tests are expected to be django unittests and second, the content of this file can be used to figure out where is the path of the django project settings and by use of eval
it will automatically set the DJANGO_SETTINGS_MODULE
env variable.
also I'm not sure it's enough or not, but I've added an extra line to use 'ast.literal_evaland check if the value that is going to be set for
DJANGO_SETTINGS_MODULE` is a safe python expression.
a new PR has been sent.
Update
unittestScripts.ts
will help the extension to recognize the Django tests and run them withDJANGO_SETTINGS_MODULE
set and also by callingdjango.setup()
it will make sure that all django apps are load and it's ready to go for tests.