33from test .support import os_helper
44from test .support import socket_helper
55from test .support import threading_helper
6+ from test .support import refleak_helper
67
78import _thread as thread
89import array
5253except ImportError :
5354 _socket = None
5455
55- _hunting_for_refleaks = None
56- def hunting_for_refleaks ():
57- """
58- Return true iff running tests while hunting for refleaks
59- """
60- from test .libregrtest .runtests import RunTests
61- import gc
62-
63- global _hunting_for_refleaks
64-
65- if _hunting_for_refleaks is None :
66- for value in gc .get_objects ():
67- if isinstance (value , RunTests ):
68- _hunting_for_refleaks = (value .hunt_refleak is not None )
69- break
70- else :
71- _hunting_for_refleaks = False
72-
73- return _hunting_for_refleaks
74-
75-
7656def skipForRefleakHuntinIf (condition , issueref ):
7757 if not condition :
7858 def decorator (f ):
@@ -83,15 +63,15 @@ def decorator(f):
8363 def decorator (f ):
8464 @contextlib .wraps (f )
8565 def wrapper (* args , ** kwds ):
86- if hunting_for_refleaks ():
66+ if refleak_helper . hunting_for_refleaks ():
8767 raise unittest .SkipTest (f"ignore while hunting for refleaks, see { issueref } " )
8868
8969 return f (* args , ** kwds )
9070
9171 def client_skip (f ):
9272 @contextlib .wraps (f )
9373 def wrapper (* args , ** kwds ):
94- if hunting_for_refleaks ():
74+ if refleak_helper . hunting_for_refleaks ():
9575 return
9676
9777 return f (* args , ** kwds )
@@ -3886,9 +3866,6 @@ def testCmsgTrunc0(self):
38863866
38873867 @testCmsgTrunc0 .client_skip
38883868 def _testCmsgTrunc0 (self ):
3889- if sys .platform == "darwin" and hunting_for_refleaks ():
3890- return
3891-
38923869 self .createAndSendFDs (1 )
38933870
38943871 # Check that no ancillary data is returned for various non-zero
0 commit comments