Use freezegun module for time-sensitive tests
Since we only use second-resolution timestamps (since commit 8ad626f1c9
and 07d8c6c83b), if we want to ensure an ordering between timestamps we
need to ensure that the store sees at least one second elapse between
them. Previously, we did this by actually sleeping for one second each
time, but this has the obvious disadvantage of significantly slowing
down the tests because they have to sleep all the time. Instead, we can
use the freezegun module, which mocks the datetime module, allowing us
to freeze time at arbitrary points, and also gives us a nicely
convenient tick() method to advance the frozen time by one second.
This cuts the time to run the non-database tests from over eight seconds
to around one second.