@@ -112,18 +112,24 @@ def test_per_thread_default_stream():
112112
113113
114114@pytest .mark .agent_authored (model = "gpt-5.6" )
115- @pytest .mark .parametrize ("stream" , [LEGACY_DEFAULT_STREAM , PER_THREAD_DEFAULT_STREAM ])
116- def test_default_stream_close_is_noop (stream , init_cuda ):
117- """Closing a process-wide default-stream token must not invalidate it."""
115+ @pytest .mark .parametrize (
116+ ("handle" , "singleton" ),
117+ [
118+ (driver .CU_STREAM_LEGACY , LEGACY_DEFAULT_STREAM ),
119+ (driver .CU_STREAM_PER_THREAD , PER_THREAD_DEFAULT_STREAM ),
120+ ],
121+ )
122+ def test_borrowed_default_stream_token_can_close (handle , singleton , init_cuda ):
118123 Device ().set_current ()
119- handle = int (stream .handle )
124+ stream = Stream .from_handle (int (handle ))
125+
126+ assert stream is not singleton
127+ assert not stream .is_closed
120128
121- stream .close ()
122129 stream .close ()
123130
124- assert not stream .is_closed
125- assert int (stream .handle ) == handle
126- assert Stream_accept (stream ) is stream
131+ assert stream .is_closed
132+ assert not singleton .is_closed
127133
128134
129135@pytest .mark .agent_authored (model = "gpt-5.6" )
0 commit comments