0
我在燒瓶應用程序中看到了一個相當奇怪的行爲:嵌套的app_contexts不能正常工作,因爲它們應該放在我的測試套件中,所以current_app localproxy沒有指向正確的應用程序。它完全同步代碼,所以沒有線程,corroutines或任何東西。燒瓶內的current_app錯誤app_context
¿某人能提供任何指導嗎?
> /.../browsepy/tests/deprecated/test_plugins.py(173)test_register_plugin()
171 self.manager = self.manager_module.PluginManager(self.app)
172 with self.app.app_context():
--> 173 self.manager.load_plugin('player')
174 self.assertIn(self.player_module.player, self.app.blueprints.values())
175
ipdb> self.app
<Flask 'TestIntegration'>
ipdb> type(self.app)
<class 'flask.app.Flask'>
ipdb> d
> /.../browsepy/manager.py(151)load_plugin()
149 module = super(RegistrablePluginManager, self).load_plugin(plugin)
150 if hasattr(module, 'register_plugin'):
--> 151 module.register_plugin(self)
152 return module
153
ipdb> current_app
<Flask 'browsepy'>
ipdb> type(current_app)
<class 'werkzeug.local.LocalProxy'>