mirror of https://github.com/fail2ban/fail2ban
py3.12: ignore smtpd based tests (if no smtpd module)
parent
70aef2c3c6
commit
ef208e9149
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue