py3.12: ignore smtpd based tests (if no smtpd module)

test-3.13.0-alpha.2
sebres 2023-12-11 21:45:34 +01:00
parent 70aef2c3c6
commit ef208e9149
1 changed files with 114 additions and 110 deletions

View File

@ -18,7 +18,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import os
import smtpd
import threading
import unittest
import re
@ -29,9 +28,11 @@ else:
import imp
from ..dummyjail import DummyJail
from ..utils import CONFIG_DIR, asyncserver, Utils, uni_decode
try:
import smtpd
class TestSMTPServer(smtpd.SMTPServer):
def __init__(self, *args):
@ -160,3 +161,6 @@ class SMTPActionTest(unittest.TestCase):
self.assertTrue("From: %s <%s>" %
(self.action.fromname, self.action.fromaddr) in self.smtpd.data)
self.assertEqual(set(self.smtpd.rcpttos), set(["test@example.com", "test2@example.com"]))
except ImportError as e:
print("I: Skipping smtp tests: %s" % e)