diff --git a/tests/test_aio.py b/tests/test_aio.py index c1243c1..d88ac18 100644 --- a/tests/test_aio.py +++ b/tests/test_aio.py @@ -348,9 +348,13 @@ async def _make_client(warning=None, **kwargs): is emitted (if any) and that the patch is properly applied by consuming the RuntimeError. """ - with pytest.warns(warning),\ - pytest.raises(RuntimeError): # Consume error - await make_aio_client(addressbook.AddressBookService, **kwargs) + if warning: + with pytest.warns(warning),\ + pytest.raises(RuntimeError): # Consume error + await make_aio_client(addressbook.AddressBookService, **kwargs) + else: + with pytest.raises(RuntimeError): # Consume error + await make_aio_client(addressbook.AddressBookService, **kwargs) def _given_timeout(self): """Get the timeout provided to TAsyncSocket."""