Something went wrong. Try again.
lol
Something went wrong. Try again.
998 B · 25 lines
at master
12345678910111213141516171819202122232425diff --git a/aioimaplib/imap_testing_server.py b/aioimaplib/imap_testing_server.pyindex b303aa3..419b808 100644--- a/aioimaplib/imap_testing_server.py+++ b/aioimaplib/imap_testing_server.py@@ -198,12 +198,18 @@ class ImapProtocol(asyncio.Protocol): DEFAULT_QUOTA = 5000 def __init__(self, server_state, fetch_chunk_size=0, capabilities=CAPABILITIES,- loop=asyncio.get_event_loop()):+ loop=None): self.uidvalidity = int(datetime.now().timestamp()) self.capabilities = capabilities self.state_to_send = list() self.delay_seconds = 0- self.loop = loop+ if loop is None:+ try:+ self.loop = asyncio.get_running_loop()+ except RuntimeError:+ self.loop = asyncio.new_event_loop()+ else:+ self.loop = loop self.fetch_chunk_size = fetch_chunk_size self.transport = None self.server_state = server_state