TST make catch_warnings blocks more robust