@@ -589,20 +589,22 @@ def test_exporter_holds_none_without_a_descriptor(self, vmm_ipc_device):
589589 @pytest .mark .thread_unsafe (reason = "counts process-global file descriptors" )
590590 def test_process_argument_releases_with_the_process_object (self , vmm_ipc_device ):
591591 """A buffer passed to a spawned Process imports there; its descriptor goes when the Process object does."""
592+ # The first spawn opens a process-wide resource-tracker pipe, which
593+ # outlives Process objects. Start it before taking the descriptor baseline.
594+ _run_child (_noop )
592595 device = vmm_ipc_device
593596 mr = _resource (device )
594- buf = mr .allocate (1 )
595- fds0 = _settled_open_fds ()
596- process = mp .Process (target = _close_argument , args = (buf ,))
597- process .start ()
598- process .join (timeout = CHILD_TIMEOUT_SEC )
599- survivors = kill_subprocesses (process )
600- assert not survivors , "child did not exit within timeout"
601- assert process .exitcode == 0 , f"child exited with { process .exitcode } "
602- del process
603- gc .collect ()
604- assert _open_fds () == fds0
605- buf .close ()
597+ with mr .allocate (1 ) as buf :
598+ fds0 = _settled_open_fds ()
599+ process = mp .Process (target = _close_argument , args = (buf ,))
600+ process .start ()
601+ process .join (timeout = CHILD_TIMEOUT_SEC )
602+ survivors = kill_subprocesses (process )
603+ assert not survivors , "child did not exit within timeout"
604+ assert process .exitcode == 0 , f"child exited with { process .exitcode } "
605+ del process
606+ gc .collect ()
607+ assert _open_fds () == fds0
606608
607609 @pytest .mark .agent_authored (model = "claude-fable-5-1" )
608610 def test_importer_holds_none_after_the_import (self , vmm_ipc_device ):
0 commit comments