我不能运行 Django Python pytest PyCharm
I can not run Django Python pytest under PyCharm
$ pytest portal/
=============================================== test session starts ===============================================
platform darwin -- Python 3.6.0, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
Django settings: config.settings.local (from ini file)
rootdir: /Users/el/Code/siam-sbrand/portal, inifile: pytest.ini
plugins: django-3.1.2
collected 87 items
portal/apps/commons/tests.py ......
portal/apps/price_list_excel_files/tests.py ssssssssssss
portal/apps/price_lists/tests.py s....
portal/apps/reports/tests.py .........................ssss..................
portal/apps/sbrand_jobs/tests.py ................
portal/apps/service_items/tests.py s
===================================== 69 passed, 18 skipped in 32.08 seconds ======================================
pytest.ini:
[pytest]
DJANGO_SETTINGS_MODULE=config.settings.local
norecursedirs = node_modules venv *.txt
python_files = tests.py Test*.py test_*.py
我已经在 pyenv
下安装了 pytest-django
。然后我想研究 PyCharm 中的关键功能,但不幸的是,当我尝试访问 JetBrain 论坛时。它仅限于公司所有者。我不能 post 我的问题,因为我只是一名雇员。
这是我点击播放 pytest
按钮的时候
/Users/el/.pyenv/versions/siam-sbrand/bin/python pytest portal
/Users/el/.pyenv/versions/siam-sbrand/bin/python: can't open file 'pytest': [Errno 2] No such file or directory
Process finished with exit code 2
**更新参考falsetru
回答
是啊!它的工作方式类似于 PyCharm
。它不是绿灯,因为我在测试中放置了 decorator skip
。非常感谢。
而不是使用 python
,您应该使用 Python tests > py.test
:
更新
您过滤了测试结果以仅显示跳过的测试。切换绿色按钮也会显示成功的测试。
$ pytest portal/
=============================================== test session starts ===============================================
platform darwin -- Python 3.6.0, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
Django settings: config.settings.local (from ini file)
rootdir: /Users/el/Code/siam-sbrand/portal, inifile: pytest.ini
plugins: django-3.1.2
collected 87 items
portal/apps/commons/tests.py ......
portal/apps/price_list_excel_files/tests.py ssssssssssss
portal/apps/price_lists/tests.py s....
portal/apps/reports/tests.py .........................ssss..................
portal/apps/sbrand_jobs/tests.py ................
portal/apps/service_items/tests.py s
===================================== 69 passed, 18 skipped in 32.08 seconds ======================================
pytest.ini:
[pytest]
DJANGO_SETTINGS_MODULE=config.settings.local
norecursedirs = node_modules venv *.txt
python_files = tests.py Test*.py test_*.py
我已经在 pyenv
下安装了 pytest-django
。然后我想研究 PyCharm 中的关键功能,但不幸的是,当我尝试访问 JetBrain 论坛时。它仅限于公司所有者。我不能 post 我的问题,因为我只是一名雇员。
这是我点击播放 pytest
按钮的时候
/Users/el/.pyenv/versions/siam-sbrand/bin/python pytest portal
/Users/el/.pyenv/versions/siam-sbrand/bin/python: can't open file 'pytest': [Errno 2] No such file or directory
Process finished with exit code 2
**更新参考falsetru
回答
是啊!它的工作方式类似于 PyCharm
。它不是绿灯,因为我在测试中放置了 decorator skip
。非常感谢。
而不是使用 python
,您应该使用 Python tests > py.test
:
更新
您过滤了测试结果以仅显示跳过的测试。切换绿色按钮也会显示成功的测试。