Skip to content

Commit 7e846aa

Browse files
committed
Stop using deprecated "unittest.makeSuite".
1 parent 1c472c1 commit 7e846aa

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

tests/test_7zfiles.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def sorted(l):
4848
if sys.version_info[:2] < (3, 0):
4949
def bytes(s, encoding):
5050
return s
51-
51+
5252
def unicode_string(s):
5353
return s.decode('latin-1')
5454
else:
@@ -122,7 +122,7 @@ def _test_umlaut_archive(self, filename):
122122
self.assertEqual(cf.read(), bytes('This file contains a german umlaut in the filename.', 'ascii'))
123123
cf.reset()
124124
self.assertEqual(cf.read(), bytes('This file contains a german umlaut in the filename.', 'ascii'))
125-
125+
126126
def test_non_solid_umlaut(self):
127127
# test loading of a non-solid archive containing files with umlauts
128128
self._test_umlaut_archive('umlaut-non_solid.7z')
@@ -350,7 +350,7 @@ def suite():
350350
]
351351

352352
for tc in test_cases:
353-
suite.addTest(unittest.makeSuite(tc))
353+
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(tc))
354354

355355
return suite
356356

tests/test_compatibility.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ def generate_random(size, choice=random.choice, ALL_CHARS=ALL_CHARS):
5151
return s
5252

5353
class TestPyLZMACompability(unittest.TestCase):
54-
54+
5555
def setUp(self):
5656
self.plain = bytes('hello, this is a test string', 'ascii')
5757
self.plain_with_eos = unhexlify('5d0000800000341949ee8def8c6b64909b1386e370bebeb1b656f5736d653c127731a214ff7031c000')
5858
self.plain_without_eos = unhexlify('5d0000800000341949ee8def8c6b64909b1386e370bebeb1b656f5736d653c115edbe9')
59-
59+
6060
def test_decompression_noeos(self):
6161
# test decompression without the end of stream marker
6262
decompressed = pylzma.decompress_compat(self.plain_without_eos)
@@ -83,7 +83,7 @@ def suite():
8383
]
8484

8585
for tc in test_cases:
86-
suite.addTest(unittest.makeSuite(tc))
86+
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(tc))
8787

8888
return suite
8989

tests/test_pylzma.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def generate_random(size, choice=random.choice, ALL_CHARS=ALL_CHARS):
5151
return s
5252

5353
class TestPyLZMA(unittest.TestCase):
54-
54+
5555
def setUp(self):
5656
self.plain = bytes('hello, this is a test string', 'ascii')
5757
self.plain_with_eos = unhexlify('5d0000800000341949ee8def8c6b64909b1386e370bebeb1b656f5736d653c127731a214ff7031c000')
@@ -64,17 +64,17 @@ def test_compression_eos(self):
6464
# test compression with end of stream marker
6565
compressed = pylzma.compress(self.plain, eos=1)
6666
self.assertEqual(compressed, self.plain_with_eos)
67-
67+
6868
def test_compression_no_eos(self):
6969
# test compression without end of stream marker
7070
compressed = pylzma.compress(self.plain, eos=0)
7171
self.assertEqual(compressed, self.plain_without_eos)
72-
72+
7373
def test_decompression_eos(self):
7474
# test decompression with the end of stream marker
7575
decompressed = pylzma.decompress(self.plain_with_eos)
7676
self.assertEqual(decompressed, self.plain)
77-
77+
7878
def test_decompression_noeos(self):
7979
# test decompression without the end of stream marker
8080
decompressed = pylzma.decompress(self.plain_without_eos, maxlength=28)
@@ -109,7 +109,7 @@ def test_decompression_stream(self):
109109
data = decompress.decompress(self.plain_with_eos)
110110
data += decompress.flush()
111111
self.assertEqual(data, self.plain)
112-
112+
113113
def test_decompression_stream_two(self):
114114
# test decompression in two steps
115115
decompress = pylzma.decompressobj()
@@ -187,7 +187,7 @@ def test_compression_file(self):
187187
self.assertEqual(check, self.plain)
188188

189189
if sys.version_info[:2] < (3, 0):
190-
190+
191191
def test_compression_file_python(self):
192192
# test compressing from file-like object (Python class)
193193
from StringIO import StringIO as PyStringIO
@@ -265,7 +265,7 @@ def suite():
265265
]
266266

267267
for tc in test_cases:
268-
suite.addTest(unittest.makeSuite(tc))
268+
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(tc))
269269

270270
return suite
271271

0 commit comments

Comments
 (0)