一旦尝试使用来自 flask_testing 的 LiveServerTestCase 在我的 Flask 应用程序上运行单元测试,我就会收到标题中提到的错误。
这是我的测试文件:
from app import create_app
from flask_testing import LiveServerTestCase
class TestBase(LiveServerTestCase):
def create_app(self):
app = create_app()
app.config.update(LIVESERVER_PORT=8847, TESTING=True)
return app
def test_app(self):
self.assertEqual('test', 'test')
这是我使用nose2运行测试时遇到的错误:
AttributeError: Can't pickle local object 'LiveServerTestCase._spawn_live_server.<locals>.worker'
During handling of the above exception, another exception occurred:
AttributeError: 'NoneType' object has no attribute 'terminate'
Internal Error: runTests aborted: 'NoneType' object has no attribute 'terminate'
我真的在网上找不到任何关于这个问题的有用信息,