File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -5010,12 +5010,21 @@ def create_and_register_resource(rtype):
50105010 _resource_unlink (name1 , rtype )
50115011 p .terminate ()
50125012 p .wait ()
5013- time .sleep (2.0 )
5014- with self .assertRaises (OSError ) as ctx :
5015- _resource_unlink (name2 , rtype )
5016- # docs say it should be ENOENT, but OSX seems to give EINVAL
5017- self .assertIn (
5018- ctx .exception .errno , (errno .ENOENT , errno .EINVAL ))
5013+
5014+ deadline = time .monotonic () + 60
5015+ while time .monotonic () < deadline :
5016+ time .sleep (.5 )
5017+ try :
5018+ _resource_unlink (name2 , rtype )
5019+ except OSError as e :
5020+ # docs say it should be ENOENT, but OSX seems to give
5021+ # EINVAL
5022+ self .assertIn (e .errno , (errno .ENOENT , errno .EINVAL ))
5023+ break
5024+ else :
5025+ raise AssertionError (
5026+ f"A { rtype } resource was leaked after a process was "
5027+ f"abruptly terminated." )
50195028 err = p .stderr .read ().decode ('utf-8' )
50205029 p .stderr .close ()
50215030 expected = ('resource_tracker: There appear to be 2 leaked {} '
You can’t perform that action at this time.
0 commit comments