Skip to content Skip to sidebar Skip to footer

Test Database Not Keeping Data During Django Channels Pytest Test

I'm writing tests for a Django Channels application following the documentation. I can successfully test connection and communication with the WebSocket consumer. However, in one o

Solution 1:

As indicated by @hoefling in the comments, the only thing missing was to make the test transactional, as seen in this question.

In my case, I only had to change the test decorator to:

@pytest.mark.django_db(transaction=True)

Post a Comment for "Test Database Not Keeping Data During Django Channels Pytest Test"