Write an easier timeout facility for tests

@rclough