aports/community/perl-mail-sendmail/fake-smtp.py
Celeste c62e1fef0d community/perl-mail-sendmail: fix fake-smtp.py test helper
`smtpd` and `asyncore` moved to `test.support` in Python 3.12

also, make some style changes that are in line with
apkbuild-cpan template 4, but don't upgrade to that
yet, as it needs a pkgrel bump to remove empty dirs
2024-04-25 02:18:17 +00:00

19 lines
476 B
Python

from test.support import smtpd
from test.support import asyncore
class FakeSMTPServer(smtpd.SMTPServer):
"""A Fake smtp server"""
def __init__(*args, **kwargs):
smtpd.SMTPServer.__init__(*args, **kwargs)
def process_message(*args, **kwargs):
pass
if __name__ == "__main__":
smtp_server = FakeSMTPServer(('127.0.0.1', 2525), None)
try:
asyncore.loop(timeout=1, count=30)
except KeyboardInterrupt:
smtp_server.close()