bpo-34582: Update syntax of Azure Pipelines builds (GH-9521)
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 99aa89b..42cceaf 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -435,18 +435,29 @@
# 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))