Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mailoutbox doesn't work correctly with celery_worker #1055

Open
mihalt opened this issue Apr 1, 2023 · 0 comments
Open

mailoutbox doesn't work correctly with celery_worker #1055

mihalt opened this issue Apr 1, 2023 · 0 comments

Comments

@mihalt
Copy link

mihalt commented Apr 1, 2023

I found a problem, that any of my tests in parametrize not get in mailoutbox enough messages that were sent by .delay as celery tasks. So, I should do at least time.sleep(1) to get remaining messages to mailoutbox before checking its lenght. Can I prevent it?

Maybe it's connected with #1054 but I am not sure.

By the way, I am using now in conftest.py to prevent using of django_db(transaction=True), but I am not sure that it will work stably. Like in this case.

@pytest.fixture(scope="session")
def celery_worker_parameters():
    from celery.fixups.django import DjangoWorkerFixup
    DjangoWorkerFixup.install = lambda x: None
    # This needed, because there is error InterfaceError: connection already closed
    # https://stackoverflow.com/questions/71472478/celery-worker-fixture-in-pytest-connection-already-closed-error

    return {"without_heartbeat": False}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant