File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,9 @@ async def test_shadow_socket(context):
134
134
135
135
136
136
async def test_shadow_socket_close (context , caplog ):
137
- with context .socket (zmq .PUSH ) as push , context .socket (zmq .PULL ) as pull :
137
+ with warnings .catch_warnings (record = True ) as records , context .socket (
138
+ zmq .PUSH
139
+ ) as push , context .socket (zmq .PULL ) as pull :
138
140
push .linger = pull .linger = 0
139
141
port = push .bind_to_random_port ('tcp://127.0.0.1' )
140
142
pull .connect (f'tcp://127.0.0.1:{ port } ' )
@@ -150,10 +152,10 @@ async def test_shadow_socket_close(context, caplog):
150
152
stream .on_recv (print )
151
153
# close the shadowed socket
152
154
pull .close ()
153
- # run the event loop, which should see some events on the shadow socket
154
- # but the socket has been closed!
155
- with warnings .catch_warnings (record = True ) as records :
155
+ # run the event loop, which should see some events on the shadow socket
156
+ # but the socket has been closed!
156
157
await asyncio .sleep (0.2 )
158
+ stream .close ()
157
159
warning_text = "\n " .join (str (r .message ) for r in records )
158
160
assert "after closing socket" in warning_text
159
161
assert "closed socket" in caplog .text
You can’t perform that action at this time.
0 commit comments