简体   繁体   English

使用django_webtest执行单个测试用例

[英]Executing a single test case with django_webtest

In my config/advertiser/tests/test_advertiser_web.py : 在我的config/advertiser/tests/test_advertiser_web.py

from django_webtest import WebTest
...
class AdvertiserView(WebTest):
...
    def test_add_note(self):
...

I'd like to just run the test_add_note case. 我只想运行test_add_note案例。 Is that possible? 那可能吗? I can't seem to figure out how to run either the individual test case or just that file. 我似乎无法弄清楚如何运行单个测试用例或仅运行该文件。

./manage.py test config.advertiser.tests.AdvertiserView
AttributeError: 'module' object has no attribute 'AdvertiserView'

./manage.py test config/advertiser/tests/test_advertiser_web.py
ImportError: Start directory is not importable: 'config/advertiser/tests/test_advertiser_web.py'

Running the whole dir seems to work just fine: 运行整个目录似乎可以正常工作:

./manage.py test config/advertiser/tests/
Creating test database....

您忘记在testsAdvertiserView之间添加模块名称:

./manage.py test config.advertiser.tests.test_advertiser_web.AdvertiserView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM