File tree 1 file changed +19
-16
lines changed
1 file changed +19
-16
lines changed Original file line number Diff line number Diff line change 1
1
import re
2
2
import sys
3
+ import textwrap
3
4
import types
4
5
import unittest
5
6
import weakref
6
7
7
8
from test import support
9
+ from test .support .script_helper import assert_python_ok
8
10
9
11
10
12
class ClearTest (unittest .TestCase ):
@@ -238,25 +240,26 @@ def inner():
238
240
class TestIncompleteFrameAreInvisible (unittest .TestCase ):
239
241
240
242
def test_issue95818 (self ):
241
- #See GH-95818 for details
242
- import gc
243
- self . addCleanup ( gc . set_threshold , * gc . get_threshold ())
243
+ # See GH-95818 for details
244
+ code = textwrap . dedent ( f"""
245
+ import gc
244
246
245
- gc .set_threshold (1 ,1 ,1 )
246
- class GCHello :
247
- def __del__ (self ):
248
- print ("Destroyed from gc" )
247
+ gc.set_threshold(1,1,1)
248
+ class GCHello:
249
+ def __del__(self):
250
+ print("Destroyed from gc")
249
251
250
- def gen ():
251
- yield
252
-
253
- fd = open (__file__ )
254
- l = [fd , GCHello ()]
255
- l .append (l )
256
- del fd
257
- del l
258
- gen ()
252
+ def gen():
253
+ yield
259
254
255
+ fd = open({ __file__ !r} )
256
+ l = [fd, GCHello()]
257
+ l.append(l)
258
+ del fd
259
+ del l
260
+ gen()
261
+ """ )
262
+ assert_python_ok ("-c" , code )
260
263
261
264
if __name__ == "__main__" :
262
265
unittest .main ()
You can’t perform that action at this time.
0 commit comments