3
3
from doctest import DocTestSuite
4
4
from test import support
5
5
import weakref
6
- import gc
6
+ # import gc
7
7
8
8
# Modules under test
9
9
import _thread
@@ -36,7 +36,7 @@ def _local_refs(self, n):
36
36
t .join ()
37
37
del t
38
38
39
- gc .collect ()
39
+ # gc.collect()
40
40
self .assertEqual (len (weaklist ), n )
41
41
42
42
# XXX _threading_local keeps the local of the last stopped thread alive.
@@ -45,7 +45,7 @@ def _local_refs(self, n):
45
45
46
46
# Assignment to the same thread local frees it sometimes (!)
47
47
local .someothervar = None
48
- gc .collect ()
48
+ # gc.collect()
49
49
deadlist = [weak for weak in weaklist if weak () is None ]
50
50
self .assertIn (len (deadlist ), (n - 1 , n ), (n , len (deadlist )))
51
51
@@ -88,7 +88,7 @@ def f():
88
88
# 2) GC the cycle (triggers threadmodule.c::local_clear
89
89
# before local_dealloc)
90
90
del cycle
91
- gc .collect ()
91
+ # gc.collect()
92
92
e1 .set ()
93
93
e2 .wait ()
94
94
@@ -108,6 +108,8 @@ def f():
108
108
109
109
self .assertTrue (passed )
110
110
111
+ # TODO: RUSTPYTHON, __new__ vs __init__ cooperation
112
+ @unittest .expectedFailure
111
113
def test_arguments (self ):
112
114
# Issue 1522237
113
115
class MyLocal (self ._local ):
@@ -180,6 +182,8 @@ class LocalSubclass(self._local):
180
182
"""To test that subclasses behave properly."""
181
183
self ._test_dict_attribute (LocalSubclass )
182
184
185
+ # TODO: RUSTPYTHON, cycle detection/collection
186
+ @unittest .expectedFailure
183
187
def test_cycle_collection (self ):
184
188
class X :
185
189
pass
@@ -189,7 +193,7 @@ class X:
189
193
x .local .x = x
190
194
wr = weakref .ref (x )
191
195
del x
192
- gc .collect ()
196
+ # gc.collect()
193
197
self .assertIsNone (wr ())
194
198
195
199
@@ -204,7 +208,7 @@ def test_main():
204
208
suite = unittest .TestSuite ()
205
209
suite .addTest (DocTestSuite ('_threading_local' ))
206
210
suite .addTest (unittest .makeSuite (ThreadLocalTest ))
207
- suite .addTest (unittest .makeSuite (PyThreadingLocalTest ))
211
+ # suite.addTest(unittest.makeSuite(PyThreadingLocalTest))
208
212
209
213
local_orig = _threading_local .local
210
214
def setUp (test ):
0 commit comments