我有幾個Django項目,我使用Jenkins進行持續集成。我已經完成了這個安排並運行了一段時間,並且運行良好。使用django-jenkins進行覆蓋測試
我希望能夠生成自動測試覆蓋率報告並讓Jenkins處理它們。它看起來像django-jenkins是這樣的方式,所以我安裝它和coverage
。
這裏是我的settings.py
相關章節:
# Jenkins integration
INSTALLED_APPS += ('django_jenkins',)
JENKINS_TASKS = (
'django_jenkins.tasks.with_coverage',
'django_jenkins.tasks.run_pylint',
'django_jenkins.tasks.django_tests',
)
PROJECT_APPS = ['myapp']
現在,我可以運行python manage.py jtest
,它按預期工作。但是,如果我跑python manage.py jenkins
,它的錯誤:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 76, in load_command_class
return module.Command()
File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django_jenkins/management/commands/__init__.py", line 61, in __init__
for module_name in self.get_task_list()]
File "/home/matthew/Projects/blah/venv/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
ImportError: No module named django_tests
我使用的是標準的Django TestCase
和LiveServerTestCase
類作爲我的測試的基礎。任何想法,我哪裏錯了?該文檔似乎暗示django_tests
已被刪除,但我無法找到任何跡象表明您現在如何運行Django測試。
我正在使用Django 1.6.2。