mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-19 01:05:15 +03:00
the test suite will send an actual email to the atuthor. We don't want to do that and some of the build servers may have smtp port blocked. Create a dummy smtp server on localhost and patch test to use that.
18 lines
440 B
Python
18 lines
440 B
Python
import smtpd
|
|
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()
|