test_checkpoint contains assorted status and error prints; some of them go to stdout and some of them go to stderr. Some of them are explicitly flushed, but many aren't, with the result that it's possible for them to appear out of order, especially when logging to a file. This can become quite misleading.
It seems like a good idea to flush them all explicitly.