@@ -44,11 +44,14 @@ def test_child_retrieves_resource_tracker(self):
44
44
# First simple fd retrieval check (see #200)
45
45
# checking fd only work on posix for now
46
46
if sys .platform != "win32" :
47
- parent_rtracker_fd = get_rtracker_fd ()
48
- executor = ProcessPoolExecutor (max_workers = 2 )
49
- child_rtracker_fd = executor .submit (get_rtracker_fd ).result ()
47
+ try :
48
+ parent_rtracker_fd = get_rtracker_fd ()
49
+ executor = ProcessPoolExecutor (max_workers = 2 )
50
+ child_rtracker_fd = executor .submit (get_rtracker_fd ).result ()
50
51
51
- assert child_rtracker_fd == parent_rtracker_fd
52
+ assert child_rtracker_fd == parent_rtracker_fd
53
+ finally :
54
+ executor .shutdown ()
52
55
53
56
# Register a resource in the parent process, and un-register it in the
54
57
# child process. If the two processes do not share the same
@@ -80,23 +83,20 @@ def maybe_unlink(name, rtype):
80
83
e.submit(maybe_unlink, filename, "file").result()
81
84
e.shutdown()
82
85
"""
83
- try :
84
- p = subprocess .run (
85
- [sys .executable , "-E" , "-c" , cmd ],
86
- capture_output = True ,
87
- text = True ,
88
- )
89
- filename = p .stdout .strip ()
90
86
91
- pattern = f"decremented refcount of file { filename } "
92
- assert pattern in p .stderr
93
- assert "leaked" not in p .stderr
87
+ p = subprocess .run (
88
+ [sys .executable , "-E" , "-c" , cmd ],
89
+ capture_output = True ,
90
+ text = True ,
91
+ )
92
+ filename = p .stdout .strip ()
94
93
95
- pattern = f"KeyError: '{ filename } '"
96
- assert pattern not in p .stderr
94
+ pattern = f"decremented refcount of file { filename } "
95
+ assert pattern in p .stderr
96
+ assert "leaked" not in p .stderr
97
97
98
- finally :
99
- executor . shutdown ()
98
+ pattern = f"KeyError: ' { filename } '"
99
+ assert pattern not in p . stderr
100
100
101
101
# The following four tests are inspired from cpython _test_multiprocessing
102
102
@pytest .mark .parametrize ("rtype" , ["file" , "folder" , "semlock" ])
0 commit comments