Can I still use `manage.py test` after switching to django-pytest?

馋奶兔 提交于 2020-06-11 06:59:08

问题


It'd be good to keep using the convention of using manage.py test to run tests instead of introducing a new command that isn't standard to Django projects.

Writing tests that py.test can consume is wonderfully concise. Can you get the best of both worlds and wire up Django's manage.py test to run those tests?


回答1:


It doesn't look like there's an out-of-the-box way to do this, so I added a PR to django-pytest to support this.

Add the following to settings.py:

TEST_RUNNER = 'pytest_django.runner.PyTestRunner'

And then you can run

manage.py test


来源:https://stackoverflow.com/questions/29419615/can-i-still-use-manage-py-test-after-switching-to-django-pytest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!