我刚刚开始为一个金字塔网络应用程序建立并运行我的测试环境。我只有一些基本的测试,包括一些由金字塔贴纸模板创建的示例。如果我通过nosetest
一切运行它们,一切正常。
如果我通过sniffer运行它们,第一次运行也可以正常工作。但是如果我更改我的代码并且嗅探器再次运行测试,我会得到以下堆栈跟踪:
======================================================================
ERROR: Failure: TypeError (isinstance() arg 2 must be a class, type, or tuple of classes and types)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/domma/Develop/WebApps/Gligg/gligg_env/lib/python2.7/site-packages/nose/loader.py", line 390, in loadTestsFromName
addr.filename, addr.module)
File "/Users/domma/Develop/WebApps/Gligg/gligg_env/lib/python2.7/site-packages/nose/importer.py", line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/domma/Develop/WebApps/Gligg/gligg_env/lib/python2.7/site-packages/nose/importer.py", line 86, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/domma/Develop/WebApps/Gligg/Gligg/gligg/__init__.py", line 1, in <module>
from pyramid.config import Configurator
File "/Users/domma/Develop/WebApps/Gligg/gligg_env/lib/python2.7/site-packages/pyramid/__init__.py", line 1, in <module>
from pyramid.request import Request
File "/Users/domma/Develop/WebApps/Gligg/gligg_env/lib/python2.7/site-packages/pyramid/request.py", line 27, in <module>
from pyramid.response import Response
File "/Users/domma/Develop/WebApps/Gligg/gligg_env/lib/python2.7/site-packages/pyramid/response.py", line 28, in <module>
class Response(_Response):
File "/Users/domma/Develop/WebApps/Gligg/gligg_env/lib/python2.7/site-packages/zope/interface/declarations.py", line 306, in __call__
classImplements(ob, *self.interfaces)
File "/Users/domma/Develop/WebApps/Gligg/gligg_env/lib/python2.7/site-packages/zope/interface/declarations.py", line 244, in classImplements
spec = implementedBy(cls)
File "/Users/domma/Develop/WebApps/Gligg/gligg_env/lib/python2.7/site-packages/zope/interface/declarations.py", line 169, in implementedByFallback
if isinstance(spec, Implements):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
----------------------------------------------------------------------
在我的设置中,我有:
self.config = testing.setUp()
engine = create_engine('sqlite://')
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
在我的拆解中:
DBSession.remove()
testing.tearDown()
导入时已经发生错误Configurator
,所以我想我错过了一些重置一些内部的清理代码。但我不知道它可能是什么。任何提示都会非常受欢迎!