3
3
from test .support import os_helper
4
4
from test .support import socket_helper
5
5
from test .support import threading_helper
6
+ from test .support import refleak_helper
6
7
7
8
import _thread as thread
8
9
import array
52
53
except ImportError :
53
54
_socket = None
54
55
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
-
76
56
def skipForRefleakHuntinIf (condition , issueref ):
77
57
if not condition :
78
58
def decorator (f ):
@@ -83,15 +63,15 @@ def decorator(f):
83
63
def decorator (f ):
84
64
@contextlib .wraps (f )
85
65
def wrapper (* args , ** kwds ):
86
- if hunting_for_refleaks ():
66
+ if refleak_helper . hunting_for_refleaks ():
87
67
raise unittest .SkipTest (f"ignore while hunting for refleaks, see { issueref } " )
88
68
89
69
return f (* args , ** kwds )
90
70
91
71
def client_skip (f ):
92
72
@contextlib .wraps (f )
93
73
def wrapper (* args , ** kwds ):
94
- if hunting_for_refleaks ():
74
+ if refleak_helper . hunting_for_refleaks ():
95
75
return
96
76
97
77
return f (* args , ** kwds )
@@ -3886,9 +3866,6 @@ def testCmsgTrunc0(self):
3886
3866
3887
3867
@testCmsgTrunc0 .client_skip
3888
3868
def _testCmsgTrunc0 (self ):
3889
- if sys .platform == "darwin" and hunting_for_refleaks ():
3890
- return
3891
-
3892
3869
self .createAndSendFDs (1 )
3893
3870
3894
3871
# Check that no ancillary data is returned for various non-zero
0 commit comments