_handle_exception in testing.py ignores passed exception