【发布时间】:2016-12-14 21:19:31
【问题描述】:
我有一个带有行为特性和单元测试测试的 Django 项目。单元测试测试的组织方式如下:
theproject/
theapp/
tests/
tests_one.py
tests_other.py
...
必须在测试文件前加上“tests_”前缀,这很烦人。
如果我重命名所有没有“tests_”的测试文件并将我的测试运行器更改为
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
在 settings.py 中做
python manage.py test -p '*.py'
我所有的单元测试都运行,但不是我的行为特性。
当我有
TEST_RUNNER = 'django_behave.runner.DjangoBehaveTestSuiteRunner'
在 settings.py 中做
python manage.py test
我的功能运行但不是我的单元测试测试。
django-behave runner 没有 -p 标志或我可以看到的等效项。
如何让 django-behave 运行程序发现名称不以“tests_”开头的文件中的测试?
【问题讨论】:
-
我没有使用行为,但也想更改搜索的文件。
标签: python django python-2.7 python-unittest python-behave