snoonetIRC / CloudBot

CloudBot - The simple, fast, expandable, open-source Python IRC Bot!
GNU General Public License v3.0
68 stars 52 forks source link

Tests: Replace time.sleep() with mocking time.time() #547

Closed linuxdaemon closed 5 years ago

linuxdaemon commented 5 years ago

In tests certain tests like https://github.com/snoonetIRC/CloudBot/blob/27d99267c66729bc02874a7f90a48cc790c48650/tests/core_tests/util_tests/test_tokenbucket.py#L37-L41 time.sleep() is used to wait for some time-based condition. Tests can be sped up if we replace time.sleep() calls with something that just increments a mocked time.time()