如何使用django-nose运行单个测试或单个TestCase? [英] How to run a single test or single TestCase with django-nose?

查看:210
本文介绍了如何使用django-nose运行单个测试或单个TestCase?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Django的常规测试运行器,您可以深入了解特定应用程序,TestCase的特定子类或TestCase特定子类中的特定测试运行测试。



例如:

  ./ manage.py test myapp.MyTestCase.test_something 

然而,django-nose似乎不支持任何超出测试特定应用程序的内容。如何复制最后两个行为?

解决方案

鼻子支持测试脚本名称和测试类名称之间的以下语法(注意 ):

  ./ manage.py test myapp.tests.test_script:MyTestCase.test_method 


With Django's normal test runner, you can drill down to run tests in a specific app, a specific subclass of TestCase, or a specific test within a specific subclass of TestCase.

E.g.:

./manage.py test myapp.MyTestCase.test_something

However, django-nose doesn't appear to support anything beyond testing a specific app. How do I replicate the last two behaviors?

解决方案

Nose supports the following syntax (note : between test script name and test class name):

./manage.py test myapp.tests.test_script:MyTestCase.test_method

这篇关于如何使用django-nose运行单个测试或单个TestCase?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆