You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The redisdb fixture runs FLUSHALL after every single test, indiscriminately deleting all the data stored on Redis.
When using an existing Redis instance for all the tests (i.e. with the redis_noproc fixture) and running tests in parallel with pytest-xdist, some tests will fail at random, because all the data is flushed amidst their execution.
importtimefrompytest_redis.factoriesimportredis_noproc, redisdbredis_noproc=redis_noproc()
redis=redisdb("redis_noproc")
deftest_one(redis):
...
deftest_two(redis):
redis.set("key", b"value")
time.sleep(1) # In the meantime, test_one will run, triggering a FLUSHALL.assertredis.get("key") ==b"value"
What are the results
The test_two will fail, because the test_one will trigger a FLUSHALL as soon as it returns.
What are the expected results
Both tests should succeed.
The text was updated successfully, but these errors were encountered:
The
redisdb
fixture runsFLUSHALL
after every single test, indiscriminately deleting all the data stored on Redis.When using an existing Redis instance for all the tests (i.e. with the
redis_noproc
fixture) and running tests in parallel with pytest-xdist, some tests will fail at random, because all the data is flushed amidst their execution.pytest-redis/pytest_redis/factories/client.py
Lines 61 to 62 in 21bc790
What action do you want to perform
$ pytest --numprocesses=2 test.py
What are the results
The
test_two
will fail, because thetest_one
will trigger aFLUSHALL
as soon as it returns.What are the expected results
Both tests should succeed.
The text was updated successfully, but these errors were encountered: