1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
From: Sandro <devel@penguinpee.nl>
Date: Sun, 7 Jul 2024 10:38:59 +0200
Subject: Python 3.13: Replace deprecated makeSuite()
The function has been deprecated in Python 3.11 and is no longer
available in Python 3.13.
Origin: upstream, https://github.com/sdgathman/pymilter/pull/65
Bug-Debian: https://bugs.debian.org/1092753
Last-Update: 2025-01-12
---
testcfg.py | 2 +-
testgrey.py | 6 +++---
testmime.py | 4 ++--
testpolicy.py | 2 +-
testsample.py | 2 +-
testutils.py | 4 ++--
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/testcfg.py b/testcfg.py
index 430a4e0..09f922a 100644
--- a/testcfg.py
+++ b/testcfg.py
@@ -11,7 +11,7 @@ class ConfigTestCase(unittest.TestCase):
miltersrs = cp.getboolean('srsmilter','miltersrs')
self.assertFalse(miltersrs)
-def suite(): return unittest.makeSuite(ConfigTestCase,'test')
+def suite(): return unittest.TestLoader().loadTestsFromTestCase(ConfigTestCase)
if __name__ == '__main__':
unittest.main()
diff --git a/testgrey.py b/testgrey.py
index 96d402e..1b03c60 100644
--- a/testgrey.py
+++ b/testgrey.py
@@ -35,7 +35,7 @@ class GreylistTestCase(unittest.TestCase):
# new one past expire
rc = grey.check('1.2.3.5','foo@bar.com','baz@spat.com',timeinc=6*3600)
self.assertEqual(rc,0)
- # original past retain
+ # original past retain
rc = grey.check('1.2.3.4','foo@bar.com','baz@spat.com',timeinc=37*24*3600)
self.assertEqual(rc,0)
# new one for testing expire
@@ -48,8 +48,8 @@ class GreylistTestCase(unittest.TestCase):
self.assertEqual(rc,1)
grey.close()
-def suite():
- s = unittest.makeSuite(GreylistTestCase,'test')
+def suite():
+ s = unittest.TestLoader().loadTestsFromTestCase(GreylistTestCase)
return s
if __name__ == '__main__':
diff --git a/testmime.py b/testmime.py
index 18a9276..a9f7318 100644
--- a/testmime.py
+++ b/testmime.py
@@ -71,7 +71,7 @@ class MimeTestCase(unittest.TestCase):
self.fail('should get boundary error parsing bad rfc822 attachment')
except errors.BoundaryError:
pass
-
+
def testDefang(self,vname='virus1',part=1,
fname='LOVE-LETTER-FOR-YOU.TXT.vbs'):
try:
@@ -234,7 +234,7 @@ class MimeTestCase(unittest.TestCase):
#print(msg + filter.msg)
self.assertTrue(result.getvalue() == msg + filter.msg)
-def suite(): return unittest.makeSuite(MimeTestCase,'test')
+def suite(): return unittest.TestLoader().loadTestsFromTestCase(MimeTestCase)
if __name__ == '__main__':
if len(sys.argv) < 2:
diff --git a/testpolicy.py b/testpolicy.py
index 732b8e0..dbe6638 100644
--- a/testpolicy.py
+++ b/testpolicy.py
@@ -42,7 +42,7 @@ class PolicyTestCase(unittest.TestCase):
pol = p.getPolicy('smtp-test')
self.assertEqual(pol,'WILDCARD')
-def suite(): return unittest.makeSuite(PolicyTestCase,'test')
+def suite(): return unittest.TestLoader().loadTestsFromTestCase(PolicyTestCase)
if __name__ == '__main__':
if len(sys.argv) < 2:
diff --git a/testsample.py b/testsample.py
index 70222bf..c86f4d4 100644
--- a/testsample.py
+++ b/testsample.py
@@ -142,7 +142,7 @@ class BMSMilterTestCase(unittest.TestCase):
f.write(fp.getvalue())
milter.close()
-def suite(): return unittest.makeSuite(BMSMilterTestCase,'test')
+def suite(): return unittest.TestLoader().loadTestsFromTestCase(BMSMilterTestCase)
if __name__ == '__main__':
unittest.main()
diff --git a/testutils.py b/testutils.py
index 93e078c..3071473 100644
--- a/testutils.py
+++ b/testutils.py
@@ -53,8 +53,8 @@ class AddrCacheTestCase(unittest.TestCase):
s = Milter.utils.parseaddr('a(WRONG)@b')
self.assertEqual(s,('WRONG', 'a@b'))
-def suite():
- s = unittest.makeSuite(AddrCacheTestCase,'test')
+def suite():
+ s = unittest.TestLoader().loadTestsFromTestCase(AddrCacheTestCase)
s.addTest(doctest.DocTestSuite(Milter.utils))
s.addTest(doctest.DocTestSuite(Milter.dynip))
s.addTest(doctest.DocTestSuite(Milter.pyip6))
|