Django LiveServerTestCase + Nose

时间:2013-06-20 23:50:48

标签: django unit-testing selenium jenkins nose

我最近发现了Django LiveServerTestCase并使用它来运行Selenium测试用例(python manage.py test)。我喜欢它的是它在后台自动运行Selenium服务器。

我想从Jenkins调整测试用例并找到这些commands

   nosetests --with-xcoverage --with-xunit --cover-package=myapp --cover-erase
   pylint -f parseable myapp/ | tee pylint.out

不幸的是,他们在执行脚本时没有运行Django测试服务器(并初始化数据库等)。

有什么办法可以让nose使用LiveServerTestCase Django的方式吗?

1 个答案:

答案 0 :(得分:0)

在这里进行反应,因为这个问题引出了一些有趣的发现。

我有类似OP的情况,我可以使用django-nose

进行排序
python manage.py test functional_tests access_control --with-coverage --cover-package=access_control --cover-html

在这种情况下,access_control是产品应用程序,functional_tests是一个带有LiveServerTestCase测试的单独应用程序。 access_control具有标准的django单元测试。