我一直在尝试在 django 项目中启动并运行一组基本的生菜测试,但我遇到了一些问题。
我按照生菜网站上的示例教程进行操作,但运行时不断出现以下错误python manage.py harvest
:
Feature: Rocking with lettuce and django #apps/my_app/features/index.feature:1
Scenario: Simple Hello World # apps/my_app/features/index.feature:3
Given I access the url "/admin" # apps/my_app/features/index-steps.py:12
Given I access the url "/admin" # apps/my_app/features/index-steps.py:12
Traceback (most recent call last):
File "/home/myhome/.virtualenvs/my_env/lib/python2.7/site-packages/lettuce/core.py", line 141, in __call__
ret = self.function(self.step, *args, **kw)
File "/home/myhome/code/my_app/apps/my_app/features/index-steps.py", line 14, in access_url
world.dom = html.fromstring(response.content)
File "/home/myhome/.virtualenvs/my_env/lib/python2.7/site-packages/lxml/html/__init__.py", line 634, in fromstring
doc = document_fromstring(html, parser=parser, base_url=base_url, **kw)
File "/home/myhome/.virtualenvs/my_env/lib/python2.7/site-packages/lxml/html/__init__.py", line 532, in document_fromstring
value = etree.fromstring(html, parser, **kw)
File "lxml.etree.pyx", line 2756, in lxml.etree.fromstring (src/lxml/lxml.etree.c:54726)
File "parser.pxi", line 1578, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:82843)
File "parser.pxi", line 1457, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:81641)
File "parser.pxi", line 965, in lxml.etree._BaseParser._parseDoc (src/lxml/lxml.etree.c:78311)
File "parser.pxi", line 569, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:74567)
File "parser.pxi", line 650, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:75458)
File "parser.pxi", line 601, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:74958)
XMLSyntaxError: None
Then I see the header "Log in | Django site admin" # apps/my_app/features/index-steps.py:17
Then I see the header "Log in | Django site admin" # apps/my_app/features/index-steps.py:17
1 feature (0 passed)
1 scenario (0 passed)
2 steps (1 failed, 1 skipped, 0 passed)
我的虚拟环境中安装了以下内容:
Django==1.4.1
MySQL-python==1.2.3
South==0.7.6
Werkzeug==0.8.3
boto==2.6.0
cssselect==0.7.1
django-extensions==0.9
django-nose==1.1
django-storages==1.1.5
django-tastypie==0.9.11
fuzzywuzzy==0.1
lettuce==0.2.10
lxml==2.3.5
mimeparse==0.1.3
mock==1.0.0
nose==1.2.1
python-dateutil==1.5
selenium==2.25.0
sure==1.0.6
wsgiref==0.1.2
这是一个错误,还是我在某个地方犯了一些错误?我原以为这个例子会涵盖它......