pytest 中的 Celery_worker 固定装置,连接已关闭错误
我有这样的 pytest 结构
import pytest
@pytest.mark.django_db
class TestClass:
def test_celery_mht_notification_create(self, celery_worker, user):
# some test logic
当我使用 celery_worker 固定装置时,我收到这样的错误 psycopg2.InterfaceError: 连接已经关闭
如何解决这个问题?
I have such pytest structure
import pytest
@pytest.mark.django_db
class TestClass:
def test_celery_mht_notification_create(self, celery_worker, user):
# some test logic
When I use celery_worker
fixture, I get such error psycopg2.InterfaceError: connection already closed
How to fix that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据解决方案他们在问题创建于pytest-django:
在第一个链接的评论线程中进一步挖掘,恕我直言,一个更干净的解决方案 被提出,并解释了为什么会发生:
According to the solution they gave you in the issue created on
pytest-django
:Digging a little more in the comments thread of the first link, what IMHO is a cleaner solution is presented, along of an explication of why it happens: