@@ -103,11 +103,15 @@ async def test_errors(harness):
103
103
104
104
async def test_unretained (harness ):
105
105
# Capture packets without retaining -> can't access payload
106
- async with harness .capture_packets_to (2 , trio .MemorySendChannel .send_nowait ) as chan :
106
+ async with harness .capture_packets_to (
107
+ 2 , trio .MemorySendChannel .send_nowait
108
+ ) as chan :
107
109
await harness .send (2 , b"one" , b"two" )
108
110
accept = True
109
111
async for p in chan :
110
- with pytest .raises (RuntimeError , match = "Payload data is no longer available" ):
112
+ with pytest .raises (
113
+ RuntimeError , match = "Payload data is no longer available"
114
+ ):
111
115
p .get_payload ()
112
116
# Can still issue verdicts though
113
117
if accept :
@@ -166,7 +170,7 @@ def cb(channel, p):
166
170
167
171
@contextmanager
168
172
def catch_unraisable_exception ():
169
- pass
173
+ yield
170
174
171
175
with catch_unraisable_exception () as unraise , trio .CancelScope () as cscope :
172
176
async with harness .capture_packets_to (2 , cb ):
@@ -188,7 +192,9 @@ def catch_unraisable_exception():
188
192
assert str (unraise .unraisable .exc_value ) == "test"
189
193
190
194
if not unraise :
191
- assert "Exception ignored in: 'netfilterqueue callback" in capsys .readouterr ().err
195
+ assert (
196
+ "Exception ignored in: 'netfilterqueue callback" in capsys .readouterr ().err
197
+ )
192
198
193
199
with pytest .raises (RuntimeError , match = "Payload data is no longer available" ):
194
200
pkt .get_payload ()
0 commit comments