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

GH-106160: Fix test_gzip failing under WASI, which does not have zlib. (GH-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.)
(cherry picked from commit 161012fc25)

Co-authored-by: T. Wouters <thomas@python.org>
This commit is contained in:
Miss Islington (bot) 2023-06-28 03:46:16 -07:00 committed by GitHub
parent 56e39192c8
commit 442f5ec042
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,6 @@ import pathlib
import struct import struct
import sys import sys
import unittest import unittest
import zlib
from subprocess import PIPE, Popen from subprocess import PIPE, Popen
from test.support import import_helper from test.support import import_helper
from test.support import os_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 from test.support.script_helper import assert_python_ok, assert_python_failure
gzip = import_helper.import_module('gzip') gzip = import_helper.import_module('gzip')
zlib = import_helper.import_module('zlib')
data1 = b""" int length=DEFAULTALLOC, err = Z_OK; data1 = b""" int length=DEFAULTALLOC, err = Z_OK;
PyObject *RetVal; PyObject *RetVal;