2828from test import support
2929from test .support import hashlib_helper
3030from test .support import import_helper
31+ from test .support import os_helper
3132from test .support import socket_helper
3233from test .support import threading_helper
34+ from test .support import warnings_helper
3335
3436
3537# Skip tests if _multiprocessing wasn't built.
@@ -615,7 +617,7 @@ def test_lose_target_ref(self):
615617
616618 @classmethod
617619 def _test_child_fd_inflation (self , evt , q ):
618- q .put (test . support .fd_count ())
620+ q .put (os_helper .fd_count ())
619621 evt .wait ()
620622
621623 def test_child_fd_inflation (self ):
@@ -819,8 +821,8 @@ def test_stderr_flush(self):
819821 if self .TYPE == "threads" :
820822 self .skipTest ('test not appropriate for {}' .format (self .TYPE ))
821823
822- testfn = test . support .TESTFN
823- self .addCleanup (test . support .unlink , testfn )
824+ testfn = os_helper .TESTFN
825+ self .addCleanup (os_helper .unlink , testfn )
824826 proc = self .Process (target = self ._test_stderr_flush , args = (testfn ,))
825827 proc .start ()
826828 proc .join ()
@@ -849,8 +851,8 @@ def test_sys_exit(self):
849851 if self .TYPE == 'threads' :
850852 self .skipTest ('test not appropriate for {}' .format (self .TYPE ))
851853
852- testfn = test . support .TESTFN
853- self .addCleanup (test . support .unlink , testfn )
854+ testfn = os_helper .TESTFN
855+ self .addCleanup (os_helper .unlink , testfn )
854856
855857 for reason in (
856858 [1 , 2 , 3 ],
@@ -1114,7 +1116,7 @@ def test_task_done(self):
11141116 close_queue (queue )
11151117
11161118 def test_no_import_lock_contention (self ):
1117- with test . support .temp_cwd ():
1119+ with os_helper .temp_cwd ():
11181120 module_name = 'imported_by_an_imported_module'
11191121 with open (module_name + '.py' , 'w' ) as f :
11201122 f .write ("""if 1:
@@ -1127,7 +1129,7 @@ def test_no_import_lock_contention(self):
11271129 del q
11281130 """ )
11291131
1130- with test . support .DirsOnSysPath (os .getcwd ()):
1132+ with import_helper .DirsOnSysPath (os .getcwd ()):
11311133 try :
11321134 __import__ (module_name )
11331135 except pyqueue .Empty :
@@ -2688,8 +2690,8 @@ def test_resource_warning(self):
26882690 # force state to RUN to emit ResourceWarning in __del__()
26892691 pool ._state = multiprocessing .pool .RUN
26902692
2691- with support .check_warnings (( 'unclosed running multiprocessing pool' ,
2692- ResourceWarning )):
2693+ with warnings_helper .check_warnings (
2694+ ( 'unclosed running multiprocessing pool' , ResourceWarning )):
26932695 pool = None
26942696 support .gc_collect ()
26952697
@@ -3199,14 +3201,14 @@ def test_fd_transfer(self):
31993201 p = self .Process (target = self ._writefd , args = (child_conn , b"foo" ))
32003202 p .daemon = True
32013203 p .start ()
3202- self .addCleanup (test . support . unlink , test . support .TESTFN )
3203- with open (test . support .TESTFN , "wb" ) as f :
3204+ self .addCleanup (os_helper . unlink , os_helper .TESTFN )
3205+ with open (os_helper .TESTFN , "wb" ) as f :
32043206 fd = f .fileno ()
32053207 if msvcrt :
32063208 fd = msvcrt .get_osfhandle (fd )
32073209 reduction .send_handle (conn , fd , p .pid )
32083210 p .join ()
3209- with open (test . support .TESTFN , "rb" ) as f :
3211+ with open (os_helper .TESTFN , "rb" ) as f :
32103212 self .assertEqual (f .read (), b"foo" )
32113213
32123214 @unittest .skipUnless (HAS_REDUCTION , "test needs multiprocessing.reduction" )
@@ -3225,8 +3227,8 @@ def test_large_fd_transfer(self):
32253227 p = self .Process (target = self ._writefd , args = (child_conn , b"bar" , True ))
32263228 p .daemon = True
32273229 p .start ()
3228- self .addCleanup (test . support . unlink , test . support .TESTFN )
3229- with open (test . support .TESTFN , "wb" ) as f :
3230+ self .addCleanup (os_helper . unlink , os_helper .TESTFN )
3231+ with open (os_helper .TESTFN , "wb" ) as f :
32303232 fd = f .fileno ()
32313233 for newfd in range (256 , MAXFD ):
32323234 if not self ._is_fd_assigned (newfd ):
@@ -3239,7 +3241,7 @@ def test_large_fd_transfer(self):
32393241 finally :
32403242 os .close (newfd )
32413243 p .join ()
3242- with open (test . support .TESTFN , "rb" ) as f :
3244+ with open (os_helper .TESTFN , "rb" ) as f :
32433245 self .assertEqual (f .read (), b"bar" )
32443246
32453247 @classmethod
0 commit comments