How to run async tests seperated from eachother so that each has it's own database? #1666
Replies: 3 comments 5 replies
-
Separate transactions should be isolated from each other. So this is a bit mysterious TBH. |
Beta Was this translation helpful? Give feedback.
-
Could this be related to: link ? |
Beta Was this translation helpful? Give feedback.
-
Note: I am currently working with OP on this problem. The test setup we have is as follows:
These two tests succeed when run individually, but fail when run together:
In the original problem statement it was theorised that this could have something to do with database transactions. The problem now seems reduced to something more general: tests interfering with each other on a more basic level. |
Beta Was this translation helpful? Give feedback.
-
We are using django-channels and have written some tests for our websocket features. We have looked at https://channels.readthedocs.io/en/stable/topics/testing.html and have setup async tests, specifically:
Running the tests one at a time succeeds as expected.
However, running the entire test suite fails.
My assumption is that this happens because the tests are executed concurrently, and while one test is reading the database, another test is writing, causing errors in assertions.
Is my assumption correct? How to resolve this issue?
Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions