Skip to content

Commit 975d5a5

Browse files
authored
Merge pull request #55 from sancode-it/smtp_stop
Replace the _stop method, which was removed from aiosmtp 1.4.3, with the cancel_tasks method
2 parents 4a5fbd8 + 6826810 commit 975d5a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pytest_localserver/smtp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ def stop(self, timeout=None):
130130
# be called more than once safely
131131
# - It passes the timeout argument to Thread.join()
132132
if self.loop.is_running():
133-
self.loop.call_soon_threadsafe(self._stop)
133+
try:
134+
self.loop.call_soon_threadsafe(self.cancel_tasks)
135+
except AttributeError:
136+
# for aiosmtpd < 1.4.3
137+
self.loop.call_soon_threadsafe(self._stop)
134138
if self._thread is not None:
135139
self._thread.join(timeout)
136140
self._thread = None

0 commit comments

Comments
 (0)