diff options
| author | Steve Dower <steve.dower@microsoft.com> | 2018-09-24 11:44:50 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-24 11:44:50 (GMT) |
| commit | 57675090b0fe7d6c7d72e56384dc2ff6798f1723 (patch) | |
| tree | 17a838f9f8c953cef01ccc2d32f00be980c8c8e3 /Lib/test | |
| parent | 2d3ff2b5ea6c903973f99d2155c9c1b60591dceb (diff) | |
| download | cpython-57675090b0fe7d6c7d72e56384dc2ff6798f1723.zip cpython-57675090b0fe7d6c7d72e56384dc2ff6798f1723.tar.gz cpython-57675090b0fe7d6c7d72e56384dc2ff6798f1723.tar.bz2 | |
bpo-34582: Update syntax of Azure Pipelines builds (GH-9521)
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_zlib.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 4871d60..bf5d64c 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -436,18 +436,29 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): # Test flush() with the various options, using all the # different levels in order to provide more variations. sync_opt = ['Z_NO_FLUSH', 'Z_SYNC_FLUSH', 'Z_FULL_FLUSH', - 'Z_PARTIAL_FLUSH', 'Z_BLOCK'] + 'Z_PARTIAL_FLUSH'] + + ver = tuple(int(v) for v in zlib.ZLIB_RUNTIME_VERSION.split('.')) + # Z_BLOCK has a known failure prior to 1.2.5.3 + if ver >= (1, 2, 5, 3): + sync_opt.append('Z_BLOCK') + sync_opt = [getattr(zlib, opt) for opt in sync_opt if hasattr(zlib, opt)] data = HAMLET_SCENE * 8 for sync in sync_opt: for level in range(10): - obj = zlib.compressobj( level ) - a = obj.compress( data[:3000] ) - b = obj.flush( sync ) - c = obj.compress( data[3000:] ) - d = obj.flush() + try: + obj = zlib.compressobj( level ) + a = obj.compress( data[:3000] ) + b = obj.flush( sync ) + c = obj.compress( data[3000:] ) + d = obj.flush() + except: + print("Error for flush mode={}, level={}" + .format(sync, level)) + raise self.assertEqual(zlib.decompress(b''.join([a,b,c,d])), data, ("Decompress failed: flush " "mode=%i, level=%i") % (sync, level)) |
