1111import unittest
1212from subprocess import PIPE , Popen
1313from test import support
14+ from test .support import import_helper
15+ from test .support import os_helper
1416from test .support import _4G , bigmemtest
1517from test .support .script_helper import assert_python_ok , assert_python_failure
1618
17- gzip = support .import_module ('gzip' )
19+ gzip = import_helper .import_module ('gzip' )
1820
1921data1 = b""" int length=DEFAULTALLOC, err = Z_OK;
2022 PyObject *RetVal;
2931"""
3032
3133
32- TEMPDIR = os .path .abspath (support .TESTFN ) + '-gzdir'
34+ TEMPDIR = os .path .abspath (os_helper .TESTFN ) + '-gzdir'
3335
3436
3537class UnseekableIO (io .BytesIO ):
@@ -44,13 +46,13 @@ def seek(self, *args):
4446
4547
4648class BaseTest (unittest .TestCase ):
47- filename = support .TESTFN
49+ filename = os_helper .TESTFN
4850
4951 def setUp (self ):
50- support .unlink (self .filename )
52+ os_helper .unlink (self .filename )
5153
5254 def tearDown (self ):
53- support .unlink (self .filename )
55+ os_helper .unlink (self .filename )
5456
5557
5658class TestGzip (BaseTest ):
@@ -286,7 +288,7 @@ def test_mode(self):
286288 self .test_write ()
287289 with gzip .GzipFile (self .filename , 'r' ) as f :
288290 self .assertEqual (f .myfileobj .mode , 'rb' )
289- support .unlink (self .filename )
291+ os_helper .unlink (self .filename )
290292 with gzip .GzipFile (self .filename , 'x' ) as f :
291293 self .assertEqual (f .myfileobj .mode , 'xb' )
292294
@@ -365,7 +367,7 @@ def test_metadata(self):
365367 self .assertEqual (isizeBytes , struct .pack ('<i' , len (data1 )))
366368
367369 def test_metadata_ascii_name (self ):
368- self .filename = support .TESTFN_ASCII
370+ self .filename = os_helper .TESTFN_ASCII
369371 self .test_metadata ()
370372
371373 def test_compresslevel_metadata (self ):
@@ -497,7 +499,7 @@ def test_fileobj_mode(self):
497499 self .assertEqual (g .mode , gzip .READ )
498500 for mode in "wb" , "ab" , "xb" :
499501 if "x" in mode :
500- support .unlink (self .filename )
502+ os_helper .unlink (self .filename )
501503 with open (self .filename , mode ) as f :
502504 with self .assertWarns (FutureWarning ):
503505 g = gzip .GzipFile (fileobj = f )
@@ -611,7 +613,7 @@ def test_binary_modes(self):
611613
612614 with self .assertRaises (FileExistsError ):
613615 gzip .open (self .filename , "xb" )
614- support .unlink (self .filename )
616+ os_helper .unlink (self .filename )
615617 with gzip .open (self .filename , "xb" ) as f :
616618 f .write (uncompressed )
617619 with open (self .filename , "rb" ) as f :
@@ -648,7 +650,7 @@ def test_implicit_binary_modes(self):
648650
649651 with self .assertRaises (FileExistsError ):
650652 gzip .open (self .filename , "x" )
651- support .unlink (self .filename )
653+ os_helper .unlink (self .filename )
652654 with gzip .open (self .filename , "x" ) as f :
653655 f .write (uncompressed )
654656 with open (self .filename , "rb" ) as f :
@@ -734,7 +736,7 @@ def wrapper(*args, **kwargs):
734736 try :
735737 return function (* args , ** kwargs )
736738 finally :
737- support .rmtree (directory )
739+ os_helper .rmtree (directory )
738740 return wrapper
739741 return decorator
740742
0 commit comments