[英]How to test django app without giving an app_name
My project structure looks like this: backend/src/apps/app_name/tests/foo.py
and when I'm trying to run the tests by entering a command python manage.py test
it runs 0 tests.我的项目结构如下所示:
backend/src/apps/app_name/tests/foo.py
当我尝试通过输入命令python manage.py test
运行测试时,它运行 0 个测试。 The only correct way to test is python manage.py test src.apps.app_name
but I'm to lazy to do it with every app.唯一正确的测试方法是
python manage.py test src.apps.app_name
但我懒得对每个应用程序都这样做。
Change改变
backend/src/apps/app_name/tests/foo.py
to至
backend/src/apps/app_name/tests/test_foo.py
Make sure all your test files and functions start with test
确保所有测试文件和函数都以
test
开头
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.