2013-02-11 42 views
2

当我运行我的单元测试,我得到这个错误:如何解决夹层单元测试失败?

FAIL: test_syntax (mezzanine.core.tests.Tests) 

回溯(最近通话最后一个):

File "/Users/taylor/aco/lib/python2.7/site-packages/mezzanine/core/tests.py", line 459, in test_syntax

self.fail("Syntax warnings!\n\n%s" % "\n".join(warnings)) AssertionError: Syntax warnings!

mezzanine/core/models.py:340: list comprehension redefines 'name' from line 331

这是唯一的错误,当我跑我的单位,我得到测试和我到处搜索找出如何解决这个错误,但我没有发现什么有用的。 有人可以请我解释一下这里发生了什么,我该如何解决它?

回答

1

我认为你正在运行Mezzanine 1.3.0,目前的稳定版本。 github中的当前主分支没有这个问题。我刚安装执行以下操作:

$ pip install git+https://github.com/stephenmcd/mezzanine.git#egg=Mezzanine 
$ mezzanine-project project 
$ python project/manage.py test 
Creating test database for alias 'default'... 
................................................................................. 
................................................................................. 
................................................................................. 
...............................s......s..................................s....... 
................................................................ 
---------------------------------------------------------------------- 
Ran 388 tests in 30.556s 

OK (skipped=3) 
Destroying test database for alias 'default'... 

对于什么是值得的,在test_syntax方法是在1.3.0运行与pyflakes.Checker测试和PEP8 Python模块失败。文件mezzanine/core/models.py有(有?)语法错误。对commits的简要扫描表明test_syntax未更改。给出错误的特定语法是mezzanine.core.models.Orderablewith_respect_to方法,它没有任何PEP8或pyflakes错误。当我针对1.3.0版本的mezzanine.core.models运行pyflakes时:

$ pyflakes ../lib/python2.6/site-packages/mezzanine/core/models.py 
../lib/python2.6/site-packages/mezzanine/core/models.py:340: list comprehension 
redefines 'name' from line 331