def test_loud_exception(self): with mail.get_connection() as connection: with pytest.raises(ValueError): send_with_connection(connection)