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