aboutsummaryrefslogtreecommitdiffstats
path: root/tests/base.py
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2020-05-27 12:51:40 +0200
committerGravatar Leon Sandøy <[email protected]>2020-05-27 12:51:40 +0200
commitb18930735e05e09ba615cb54fe1dbdfd41bb0f81 (patch)
tree6d9289baf36b5a93955e11a9405ee7159c1cadb7 /tests/base.py
parentClear cache in asyncSetUp instead of tests. (diff)
Refactor .increment and add lock test.
The way we were doing the asyncio.Lock() stuff for increment was slightly problematic. @aeros has adviced us that it's better to just initialize the lock as None in __init__, and then initialize it inside the first coroutine that uses it instead. This ensures that the correct loop gets attached to the lock, so we don't end up getting errors like this one: RuntimeError: got Future <Future pending> attached to a different loop This happens because the lock and the actual calling coroutines aren't on the same loop. When creating a new test, test_increment_lock, we discovered that we needed a small refactor here and also in the test class to make this new test pass. So, now we're creating a DummyCog for every test method, and this will ensure the loop streams never cross. Cause we all know we must never cross the streams.
Diffstat (limited to 'tests/base.py')
0 files changed, 0 insertions, 0 deletions