问题
I can not run Django Python pytest under PyCharm
After I got the answer from the above URL. I am now trying to fully utilize my IDE functions as much as I can.
Here is another project in my company that using Django UnitTest
. This is the command line I used.$ python manage.py test --settings=eneos.config.settings.local
Actually --settings=eneos.config.settings.local
is not required, because I put that config in the wsgi.py
already. But explicit is better than implicit when I ask the question.
Unfortunately. It is not simple like pytest
. I must miss some points in here.
First several lines in the window.
/Users/el/.pyenv/versions/eneos-pos-web/bin/python "/Users/el/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/171.4694.38/PyCharm.app/Contents/helpers/pycharm/_jb_unittest_runner.py" --path .
Testing started at 2:17 PM ...
Launching unittests with arguments python -m unittest discover -s . -t /Users/el/Code/eneos-pos-web in /Users/el/Code/eneos-pos-web
Error
Traceback (most recent call last):
Update: It used to ask me with Exclamation mark and let me fix the path in the bottom right. Just put working directory and configuration file in the asking form.
Done!
回答1:
There is a Django tests run configuration.
Using that, you can set Django-specific options; Custom settings
, for example.
来源:https://stackoverflow.com/questions/44868381/setting-pycharm-run-django-unittest