]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-106160: Fix test_gzip failing under WASI, which does not have zlib. (#106167)
authorT. Wouters <thomas@python.org>
Wed, 28 Jun 2023 00:55:11 +0000 (02:55 +0200)
committerGitHub <noreply@github.com>
Wed, 28 Jun 2023 00:55:11 +0000 (00:55 +0000)
Fix test_gzip's failure under WASI, which does not have zlib, by using
test.support.import_helper.import_module to import zlib. (gzip
unconditionally imports zlib, so this does not cause any new skips.)

Lib/test/test_gzip.py

index c7ac7c687c8b2d0c96a359858c3731284e69edb5..b06b3b09411d62823a62cd336c2ea7ae661e78ed 100644 (file)
@@ -9,7 +9,6 @@ import pathlib
 import struct
 import sys
 import unittest
-import zlib
 from subprocess import PIPE, Popen
 from test.support import import_helper
 from test.support import os_helper
@@ -17,6 +16,7 @@ from test.support import _4G, bigmemtest, requires_subprocess
 from test.support.script_helper import assert_python_ok, assert_python_failure
 
 gzip = import_helper.import_module('gzip')
+zlib = import_helper.import_module('zlib')
 
 data1 = b"""  int length=DEFAULTALLOC, err = Z_OK;
   PyObject *RetVal;