File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ def run(self):
307
307
assert test_local .counter == 6
308
308
309
309
310
- def test_local_del_swallows_type_error (monkeypatch ):
310
+ def test_local_clear_swallows_type_error (monkeypatch ):
311
311
test_local = Local ()
312
312
313
313
blow_up_calls = 0
@@ -319,6 +319,22 @@ def blow_up(self):
319
319
320
320
monkeypatch .setattr ("weakref.WeakSet.__iter__" , blow_up )
321
321
322
- test_local .__del__ ()
322
+ test_local .clear ()
323
323
324
324
assert blow_up_calls == 1
325
+
326
+
327
+ def test_local_clears_on_deletion (monkeypatch ):
328
+ test_local = Local ()
329
+
330
+ clear_patched_call_count = 0
331
+
332
+ def clear_patched (self ):
333
+ nonlocal clear_patched_call_count
334
+ clear_patched_call_count += 1
335
+
336
+ monkeypatch .setattr (test_local .clear , clear_patched )
337
+
338
+ del test_local
339
+
340
+ assert clear_patched_call_count == 1
You can’t perform that action at this time.
0 commit comments