Add a sleep function that is safe to use within tests