[Python-checkins] GH-106160: Fix test_gzip failing under WASI, which does not have zlib. (#106167)

Yhg1s webhook-mailer at python.org
Tue Jun 27 20:55:14 EDT 2023


https://github.com/python/cpython/commit/161012fc25910a47423bae8012398bf519a88140
commit: 161012fc25910a47423bae8012398bf519a88140
branch: main
author: T. Wouters <thomas at python.org>
committer: Yhg1s <thomas at python.org>
date: 2023-06-28T00:55:11Z
summary:

GH-106160: Fix test_gzip failing under WASI, which does not have zlib. (#106167)

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.)

files:
M Lib/test/test_gzip.py

diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index c7ac7c687c8b2..b06b3b09411d6 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -9,7 +9,6 @@
 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.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;



More information about the Python-checkins mailing list