TST: test case for flushlogs
TST: fix flushlogs and include test for STDERR flushing