Unit testing 如何修复夹层单元测试失败?

Unit testing 如何修复夹层单元测试失败?,unit-testing,mezzanine,Unit Testing,Mezzanine,当我运行单元测试时,出现以下错误: FAIL: test_syntax (mezzanine.core.tests.Tests) 回溯(最近一次呼叫最后一次): 文件“/Users/taylor/aco/lib/python2.7/site packages/mezzanine/core/tests.py”,第459行,测试语法 self.fail(“语法警告!\n\n%s”%“\n”.join(警告)) 断言错误:语法警告 mezzanine/core/models.py:340:list

当我运行单元测试时,出现以下错误:

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

回溯(最近一次呼叫最后一次):

文件“/Users/taylor/aco/lib/python2.7/site packages/mezzanine/core/tests.py”,第459行,测试语法

self.fail(“语法警告!\n\n%s”%“\n”.join(警告)) 断言错误:语法警告

mezzanine/core/models.py:340:list-comprehension从第331行重新定义了“name”

这是我在运行单元测试时遇到的唯一错误,我到处都在搜索以找出如何修复此错误,但我没有发现任何有用的错误。
有人能给我解释一下这里发生了什么事以及我如何解决它吗

我猜您正在运行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'...
值得一提的是,在1.3.0中失败的
test\u语法
方法使用pyflakes.Checker和pep8 Python模块运行测试。文件
mezzanine/core/models.py
有(有?)语法错误。对的简短扫描表明,
测试语法
没有更改。给出错误的特定语法在
mezzanine.core.models.Orderable
的方法中,该方法没有任何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