Skip to content

Commit 0f88e67

Browse files
committed
Remove Python 3.5 compatibiltiy code
Our SMTP Server implementation normally calls asyncio.base_events.Server.is_serving() to test whether the server is active, but that method only exists in Python 3.6 and up. For Python 3.5 it had to fall back to asyncio.base_events.BaseEventLoop.is_running(). Now that we no longer support Python 3.5, that fallback is no longer necessary, so I'm removing it.
1 parent 5ead723 commit 0f88e67

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

pytest_localserver/smtp.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,7 @@ def is_alive(self):
9595

9696
@property
9797
def accepting(self):
98-
try:
99-
return self.server.is_serving()
100-
except AttributeError:
101-
# asyncio.base_events.Server.is_serving() only exists in Python 3.6
102-
# and up. For Python 3.5, asyncio.base_events.BaseEventLoop.is_running()
103-
# is a close approximation; it should mostly return the same value
104-
# except for brief periods when the server is starting up or shutting
105-
# down. Once we drop support for Python 3.5, this branch becomes
106-
# unnecessary.
107-
return self.loop.is_running()
98+
return self.server.is_serving()
10899

109100
# for aiosmtpd <1.4
110101
if not hasattr(aiosmtpd.controller.Controller, "_trigger_server"):

0 commit comments

Comments
 (0)