llvmlite 0.46.0b1__cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of llvmlite might be problematic. Click here for more details.
- llvmlite/__init__.py +11 -0
- llvmlite/_version.py +11 -0
- llvmlite/binding/__init__.py +18 -0
- llvmlite/binding/analysis.py +69 -0
- llvmlite/binding/common.py +34 -0
- llvmlite/binding/config.py +143 -0
- llvmlite/binding/context.py +31 -0
- llvmlite/binding/dylib.py +45 -0
- llvmlite/binding/executionengine.py +330 -0
- llvmlite/binding/ffi.py +395 -0
- llvmlite/binding/initfini.py +85 -0
- llvmlite/binding/libllvmlite.so +0 -0
- llvmlite/binding/linker.py +20 -0
- llvmlite/binding/module.py +349 -0
- llvmlite/binding/newpassmanagers.py +1049 -0
- llvmlite/binding/object_file.py +82 -0
- llvmlite/binding/options.py +17 -0
- llvmlite/binding/orcjit.py +342 -0
- llvmlite/binding/targets.py +462 -0
- llvmlite/binding/typeref.py +267 -0
- llvmlite/binding/value.py +632 -0
- llvmlite/ir/__init__.py +11 -0
- llvmlite/ir/_utils.py +80 -0
- llvmlite/ir/builder.py +1120 -0
- llvmlite/ir/context.py +20 -0
- llvmlite/ir/instructions.py +920 -0
- llvmlite/ir/module.py +256 -0
- llvmlite/ir/transforms.py +64 -0
- llvmlite/ir/types.py +730 -0
- llvmlite/ir/values.py +1217 -0
- llvmlite/tests/__init__.py +57 -0
- llvmlite/tests/__main__.py +3 -0
- llvmlite/tests/customize.py +407 -0
- llvmlite/tests/refprune_proto.py +330 -0
- llvmlite/tests/test_binding.py +3155 -0
- llvmlite/tests/test_ir.py +3095 -0
- llvmlite/tests/test_refprune.py +574 -0
- llvmlite/tests/test_valuerepr.py +60 -0
- llvmlite/utils.py +29 -0
- llvmlite-0.46.0b1.dist-info/METADATA +145 -0
- llvmlite-0.46.0b1.dist-info/RECORD +45 -0
- llvmlite-0.46.0b1.dist-info/WHEEL +6 -0
- llvmlite-0.46.0b1.dist-info/licenses/LICENSE +24 -0
- llvmlite-0.46.0b1.dist-info/licenses/LICENSE.thirdparty +225 -0
- llvmlite-0.46.0b1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
import unittest
|
|
4
|
+
from unittest import TestCase
|
|
5
|
+
|
|
6
|
+
import faulthandler
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
# May fail in IPython Notebook with UnsupportedOperation
|
|
11
|
+
faulthandler.enable()
|
|
12
|
+
except BaseException as e:
|
|
13
|
+
msg = "Failed to enable faulthandler due to:\n{err}"
|
|
14
|
+
warnings.warn(msg.format(err=e))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# Try to inject Numba's unittest customizations.
|
|
18
|
+
from llvmlite.tests import customize
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def discover_tests(startdir):
|
|
22
|
+
"""Discover test under a directory
|
|
23
|
+
"""
|
|
24
|
+
# Avoid importing unittest
|
|
25
|
+
loader = unittest.TestLoader()
|
|
26
|
+
suite = loader.discover(startdir)
|
|
27
|
+
return suite
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def run_tests(suite=None, xmloutput=None, verbosity=1):
|
|
31
|
+
"""
|
|
32
|
+
args
|
|
33
|
+
----
|
|
34
|
+
- suite [TestSuite]
|
|
35
|
+
A suite of all tests to run
|
|
36
|
+
- xmloutput [str or None]
|
|
37
|
+
Path of XML output directory (optional)
|
|
38
|
+
- verbosity [int]
|
|
39
|
+
Verbosity level of tests output
|
|
40
|
+
|
|
41
|
+
Returns the TestResult object after running the test *suite*.
|
|
42
|
+
"""
|
|
43
|
+
if suite is None:
|
|
44
|
+
suite = discover_tests("llvmlite.tests")
|
|
45
|
+
if xmloutput is not None:
|
|
46
|
+
import xmlrunner
|
|
47
|
+
runner = xmlrunner.XMLTestRunner(output=xmloutput)
|
|
48
|
+
else:
|
|
49
|
+
runner = None
|
|
50
|
+
prog = unittest.main(suite=suite, testRunner=runner, exit=False,
|
|
51
|
+
verbosity=verbosity)
|
|
52
|
+
return prog.result
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def main():
|
|
56
|
+
res = run_tests()
|
|
57
|
+
sys.exit(0 if res.wasSuccessful() else 1)
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
# XXX Ripped off from numba.tests; we should factor it out somewhere?
|
|
2
|
+
|
|
3
|
+
import collections
|
|
4
|
+
import contextlib
|
|
5
|
+
import cProfile
|
|
6
|
+
from io import StringIO
|
|
7
|
+
import gc
|
|
8
|
+
import os
|
|
9
|
+
import multiprocessing
|
|
10
|
+
import sys
|
|
11
|
+
import time
|
|
12
|
+
import unittest
|
|
13
|
+
import warnings
|
|
14
|
+
from unittest import result, runner, signals
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# "unittest.main" is really the TestProgram class!
|
|
18
|
+
# (defined in a module named itself "unittest.main"...)
|
|
19
|
+
|
|
20
|
+
class NumbaTestProgram(unittest.main):
|
|
21
|
+
"""
|
|
22
|
+
A TestProgram subclass adding the following options:
|
|
23
|
+
* a -R option to enable reference leak detection
|
|
24
|
+
* a --profile option to enable profiling of the test run
|
|
25
|
+
|
|
26
|
+
Currently the options are only added in 3.4+.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
refleak = False
|
|
30
|
+
profile = False
|
|
31
|
+
multiprocess = False
|
|
32
|
+
|
|
33
|
+
def __init__(self, *args, **kwargs):
|
|
34
|
+
self.discovered_suite = kwargs.pop('suite', None)
|
|
35
|
+
# HACK to force unittest not to change warning display options
|
|
36
|
+
# (so that NumbaWarnings don't appear all over the place)
|
|
37
|
+
sys.warnoptions.append(':x')
|
|
38
|
+
super(NumbaTestProgram, self).__init__(*args, **kwargs)
|
|
39
|
+
|
|
40
|
+
def createTests(self):
|
|
41
|
+
if self.discovered_suite is not None:
|
|
42
|
+
self.test = self.discovered_suite
|
|
43
|
+
else:
|
|
44
|
+
super(NumbaTestProgram, self).createTests()
|
|
45
|
+
|
|
46
|
+
def _getParentArgParser(self):
|
|
47
|
+
# NOTE: this hook only exists on Python 3.4+. The options won't be
|
|
48
|
+
# added in earlier versions (which use optparse - 3.3 - or getopt()
|
|
49
|
+
# - 2.x).
|
|
50
|
+
parser = super(NumbaTestProgram, self)._getParentArgParser()
|
|
51
|
+
if self.testRunner is None:
|
|
52
|
+
parser.add_argument('-R', '--refleak', dest='refleak',
|
|
53
|
+
action='store_true',
|
|
54
|
+
help='Detect reference / memory leaks')
|
|
55
|
+
parser.add_argument('-m', '--multiprocess', dest='multiprocess',
|
|
56
|
+
action='store_true',
|
|
57
|
+
help='Parallelize tests')
|
|
58
|
+
parser.add_argument('--profile', dest='profile',
|
|
59
|
+
action='store_true',
|
|
60
|
+
help='Profile the test run')
|
|
61
|
+
return parser
|
|
62
|
+
|
|
63
|
+
def parseArgs(self, argv):
|
|
64
|
+
if sys.version_info < (3, 4):
|
|
65
|
+
# We want these options to work on all versions, emulate them.
|
|
66
|
+
if '-R' in argv:
|
|
67
|
+
argv.remove('-R')
|
|
68
|
+
self.refleak = True
|
|
69
|
+
if '-m' in argv:
|
|
70
|
+
argv.remove('-m')
|
|
71
|
+
self.multiprocess = True
|
|
72
|
+
super(NumbaTestProgram, self).parseArgs(argv)
|
|
73
|
+
if self.verbosity <= 0:
|
|
74
|
+
# We aren't interested in informational messages / warnings when
|
|
75
|
+
# running with '-q'.
|
|
76
|
+
self.buffer = True
|
|
77
|
+
|
|
78
|
+
def runTests(self):
|
|
79
|
+
if self.refleak:
|
|
80
|
+
self.testRunner = RefleakTestRunner
|
|
81
|
+
|
|
82
|
+
if not hasattr(sys, "gettotalrefcount"):
|
|
83
|
+
warnings.warn("detecting reference leaks requires a debug "
|
|
84
|
+
"build of Python, only memory leaks will be "
|
|
85
|
+
"detected")
|
|
86
|
+
|
|
87
|
+
elif self.testRunner is None:
|
|
88
|
+
self.testRunner = unittest.TextTestRunner
|
|
89
|
+
|
|
90
|
+
if self.multiprocess:
|
|
91
|
+
self.testRunner = ParallelTestRunner(self.testRunner,
|
|
92
|
+
verbosity=self.verbosity,
|
|
93
|
+
failfast=self.failfast,
|
|
94
|
+
buffer=self.buffer)
|
|
95
|
+
|
|
96
|
+
def run_tests_real():
|
|
97
|
+
super(NumbaTestProgram, self).runTests()
|
|
98
|
+
|
|
99
|
+
if self.profile:
|
|
100
|
+
filename = os.path.splitext(
|
|
101
|
+
os.path.basename(sys.modules['__main__'].__file__)
|
|
102
|
+
)[0] + '.prof'
|
|
103
|
+
p = cProfile.Profile(timer=time.perf_counter) # 3.3+
|
|
104
|
+
p.enable()
|
|
105
|
+
try:
|
|
106
|
+
p.runcall(run_tests_real)
|
|
107
|
+
finally:
|
|
108
|
+
p.disable()
|
|
109
|
+
print("Writing test profile data into %r" % (filename,))
|
|
110
|
+
p.dump_stats(filename)
|
|
111
|
+
else:
|
|
112
|
+
run_tests_real()
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# Monkey-patch unittest so that individual test modules get our custom
|
|
116
|
+
# options for free.
|
|
117
|
+
unittest.main = NumbaTestProgram
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# The reference leak detection code is liberally taken and adapted from
|
|
121
|
+
# Python's own Lib/test/regrtest.py.
|
|
122
|
+
|
|
123
|
+
def _refleak_cleanup():
|
|
124
|
+
# Collect cyclic trash and read memory statistics immediately after.
|
|
125
|
+
try:
|
|
126
|
+
func1 = sys.getallocatedblocks
|
|
127
|
+
except AttributeError:
|
|
128
|
+
def func1():
|
|
129
|
+
return 42
|
|
130
|
+
try:
|
|
131
|
+
func2 = sys.gettotalrefcount
|
|
132
|
+
except AttributeError:
|
|
133
|
+
def func2():
|
|
134
|
+
return 42
|
|
135
|
+
|
|
136
|
+
# Flush standard output, so that buffered data is sent to the OS and
|
|
137
|
+
# associated Python objects are reclaimed.
|
|
138
|
+
for stream in (sys.stdout, sys.stderr, sys.__stdout__, sys.__stderr__):
|
|
139
|
+
if stream is not None:
|
|
140
|
+
stream.flush()
|
|
141
|
+
|
|
142
|
+
sys._clear_type_cache()
|
|
143
|
+
# This also clears the various internal CPython freelists.
|
|
144
|
+
gc.collect()
|
|
145
|
+
return func1(), func2()
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class ReferenceLeakError(RuntimeError):
|
|
149
|
+
pass
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class IntPool(collections.defaultdict):
|
|
153
|
+
|
|
154
|
+
def __missing__(self, key):
|
|
155
|
+
return key
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class RefleakTestResult(runner.TextTestResult):
|
|
159
|
+
|
|
160
|
+
warmup = 3
|
|
161
|
+
repetitions = 6
|
|
162
|
+
|
|
163
|
+
def _huntLeaks(self, test):
|
|
164
|
+
self.stream.flush()
|
|
165
|
+
|
|
166
|
+
repcount = self.repetitions
|
|
167
|
+
nwarmup = self.warmup
|
|
168
|
+
rc_deltas = [0] * (repcount - nwarmup)
|
|
169
|
+
alloc_deltas = [0] * (repcount - nwarmup)
|
|
170
|
+
# Preallocate ints likely to be stored in rc_deltas and alloc_deltas,
|
|
171
|
+
# to make sys.getallocatedblocks() less flaky.
|
|
172
|
+
_int_pool = IntPool()
|
|
173
|
+
for i in range(-200, 200):
|
|
174
|
+
_int_pool[i]
|
|
175
|
+
|
|
176
|
+
alloc_before = rc_before = 0
|
|
177
|
+
for i in range(repcount):
|
|
178
|
+
# Use a pristine, silent result object to avoid recursion
|
|
179
|
+
res = result.TestResult()
|
|
180
|
+
test.run(res)
|
|
181
|
+
# Poorly-written tests may fail when run several times.
|
|
182
|
+
# In this case, abort the refleak run and report the failure.
|
|
183
|
+
if not res.wasSuccessful():
|
|
184
|
+
self.failures.extend(res.failures)
|
|
185
|
+
self.errors.extend(res.errors)
|
|
186
|
+
raise AssertionError
|
|
187
|
+
del res
|
|
188
|
+
alloc_after, rc_after = _refleak_cleanup()
|
|
189
|
+
if i >= nwarmup:
|
|
190
|
+
rc_deltas[i - nwarmup] = _int_pool[rc_after - rc_before]
|
|
191
|
+
alloc_deltas[i -
|
|
192
|
+
nwarmup] = _int_pool[alloc_after -
|
|
193
|
+
alloc_before]
|
|
194
|
+
alloc_before, rc_before = alloc_after, rc_after
|
|
195
|
+
return rc_deltas, alloc_deltas
|
|
196
|
+
|
|
197
|
+
def addSuccess(self, test):
|
|
198
|
+
try:
|
|
199
|
+
rc_deltas, alloc_deltas = self._huntLeaks(test)
|
|
200
|
+
except AssertionError:
|
|
201
|
+
# Test failed when repeated
|
|
202
|
+
assert not self.wasSuccessful()
|
|
203
|
+
return
|
|
204
|
+
|
|
205
|
+
# These checkers return False on success, True on failure
|
|
206
|
+
def check_rc_deltas(deltas):
|
|
207
|
+
return any(deltas)
|
|
208
|
+
|
|
209
|
+
def check_alloc_deltas(deltas):
|
|
210
|
+
# At least 1/3rd of 0s
|
|
211
|
+
if 3 * deltas.count(0) < len(deltas):
|
|
212
|
+
return True
|
|
213
|
+
# Nothing else than 1s, 0s and -1s
|
|
214
|
+
if not set(deltas) <= set((1, 0, -1)):
|
|
215
|
+
return True
|
|
216
|
+
return False
|
|
217
|
+
|
|
218
|
+
failed = False
|
|
219
|
+
|
|
220
|
+
for deltas, item_name, checker in [
|
|
221
|
+
(rc_deltas, 'references', check_rc_deltas),
|
|
222
|
+
(alloc_deltas, 'memory blocks', check_alloc_deltas)]:
|
|
223
|
+
if checker(deltas):
|
|
224
|
+
msg = '%s leaked %s %s, sum=%s' % (
|
|
225
|
+
test, deltas, item_name, sum(deltas))
|
|
226
|
+
failed = True
|
|
227
|
+
try:
|
|
228
|
+
raise ReferenceLeakError(msg)
|
|
229
|
+
except Exception:
|
|
230
|
+
exc_info = sys.exc_info()
|
|
231
|
+
if self.showAll:
|
|
232
|
+
self.stream.write("%s = %r " % (item_name, deltas))
|
|
233
|
+
self.addFailure(test, exc_info)
|
|
234
|
+
|
|
235
|
+
if not failed:
|
|
236
|
+
super(RefleakTestResult, self).addSuccess(test)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class RefleakTestRunner(runner.TextTestRunner):
|
|
240
|
+
resultclass = RefleakTestResult
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def _flatten_suite(test):
|
|
244
|
+
"""Expand suite into list of tests
|
|
245
|
+
"""
|
|
246
|
+
if isinstance(test, unittest.TestSuite):
|
|
247
|
+
tests = []
|
|
248
|
+
for x in test:
|
|
249
|
+
tests.extend(_flatten_suite(x))
|
|
250
|
+
return tests
|
|
251
|
+
else:
|
|
252
|
+
return [test]
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class ParallelTestResult(runner.TextTestResult):
|
|
256
|
+
"""
|
|
257
|
+
A TestResult able to inject results from other results.
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
def add_results(self, result):
|
|
261
|
+
"""
|
|
262
|
+
Add the results from the other *result* to this result.
|
|
263
|
+
"""
|
|
264
|
+
self.stream.write(result.stream.getvalue())
|
|
265
|
+
self.stream.flush()
|
|
266
|
+
self.testsRun += result.testsRun
|
|
267
|
+
self.failures.extend(result.failures)
|
|
268
|
+
self.errors.extend(result.errors)
|
|
269
|
+
self.skipped.extend(result.skipped)
|
|
270
|
+
self.expectedFailures.extend(result.expectedFailures)
|
|
271
|
+
self.unexpectedSuccesses.extend(result.unexpectedSuccesses)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class _MinimalResult(object):
|
|
275
|
+
"""
|
|
276
|
+
A minimal, picklable TestResult-alike object.
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
__slots__ = (
|
|
280
|
+
'failures', 'errors', 'skipped', 'expectedFailures',
|
|
281
|
+
'unexpectedSuccesses', 'stream', 'shouldStop', 'testsRun')
|
|
282
|
+
|
|
283
|
+
def fixup_case(self, case):
|
|
284
|
+
"""
|
|
285
|
+
Remove any unpicklable attributes from TestCase instance *case*.
|
|
286
|
+
"""
|
|
287
|
+
# Python 3.3 doesn't reset this one.
|
|
288
|
+
case._outcomeForDoCleanups = None
|
|
289
|
+
|
|
290
|
+
def __init__(self, original_result):
|
|
291
|
+
for attr in self.__slots__:
|
|
292
|
+
setattr(self, attr, getattr(original_result, attr))
|
|
293
|
+
for case, _ in self.expectedFailures:
|
|
294
|
+
self.fixup_case(case)
|
|
295
|
+
for case, _ in self.errors:
|
|
296
|
+
self.fixup_case(case)
|
|
297
|
+
for case, _ in self.failures:
|
|
298
|
+
self.fixup_case(case)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
class _FakeStringIO(object):
|
|
302
|
+
"""
|
|
303
|
+
A trivial picklable StringIO-alike for Python 2.
|
|
304
|
+
"""
|
|
305
|
+
|
|
306
|
+
def __init__(self, value):
|
|
307
|
+
self._value = value
|
|
308
|
+
|
|
309
|
+
def getvalue(self):
|
|
310
|
+
return self._value
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
class _MinimalRunner(object):
|
|
314
|
+
"""
|
|
315
|
+
A minimal picklable object able to instantiate a runner in a
|
|
316
|
+
child process and run a test case with it.
|
|
317
|
+
"""
|
|
318
|
+
|
|
319
|
+
def __init__(self, runner_cls, runner_args):
|
|
320
|
+
self.runner_cls = runner_cls
|
|
321
|
+
self.runner_args = runner_args
|
|
322
|
+
|
|
323
|
+
# Python 2 doesn't know how to pickle instance methods, so we use __call__
|
|
324
|
+
# instead.
|
|
325
|
+
|
|
326
|
+
def __call__(self, test):
|
|
327
|
+
# Executed in child process
|
|
328
|
+
kwargs = self.runner_args
|
|
329
|
+
# Force recording of output in a buffer (it will be printed out
|
|
330
|
+
# by the parent).
|
|
331
|
+
kwargs['stream'] = StringIO()
|
|
332
|
+
runner = self.runner_cls(**kwargs)
|
|
333
|
+
result = runner._makeResult()
|
|
334
|
+
# Avoid child tracebacks when Ctrl-C is pressed.
|
|
335
|
+
signals.installHandler()
|
|
336
|
+
signals.registerResult(result)
|
|
337
|
+
result.failfast = runner.failfast
|
|
338
|
+
result.buffer = runner.buffer
|
|
339
|
+
with self.cleanup_object(test):
|
|
340
|
+
test(result)
|
|
341
|
+
# HACK as cStringIO.StringIO isn't picklable in 2.x
|
|
342
|
+
result.stream = _FakeStringIO(result.stream.getvalue())
|
|
343
|
+
return _MinimalResult(result)
|
|
344
|
+
|
|
345
|
+
@contextlib.contextmanager
|
|
346
|
+
def cleanup_object(self, test):
|
|
347
|
+
"""
|
|
348
|
+
A context manager which cleans up unwanted attributes on a test case
|
|
349
|
+
(or any other object).
|
|
350
|
+
"""
|
|
351
|
+
vanilla_attrs = set(test.__dict__)
|
|
352
|
+
try:
|
|
353
|
+
yield test
|
|
354
|
+
finally:
|
|
355
|
+
spurious_attrs = set(test.__dict__) - vanilla_attrs
|
|
356
|
+
for name in spurious_attrs:
|
|
357
|
+
del test.__dict__[name]
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
class ParallelTestRunner(runner.TextTestRunner):
|
|
361
|
+
"""
|
|
362
|
+
A test runner which delegates the actual running to a pool of child
|
|
363
|
+
processes.
|
|
364
|
+
"""
|
|
365
|
+
|
|
366
|
+
resultclass = ParallelTestResult
|
|
367
|
+
|
|
368
|
+
def __init__(self, runner_cls, **kwargs):
|
|
369
|
+
runner.TextTestRunner.__init__(self, **kwargs)
|
|
370
|
+
self.runner_cls = runner_cls
|
|
371
|
+
self.runner_args = kwargs
|
|
372
|
+
|
|
373
|
+
def _run_inner(self, result):
|
|
374
|
+
# We hijack TextTestRunner.run()'s inner logic by passing this
|
|
375
|
+
# method as if it were a test case.
|
|
376
|
+
child_runner = _MinimalRunner(self.runner_cls, self.runner_args)
|
|
377
|
+
pool = multiprocessing.Pool()
|
|
378
|
+
imap = pool.imap_unordered
|
|
379
|
+
try:
|
|
380
|
+
for child_result in imap(child_runner, self._test_list):
|
|
381
|
+
result.add_results(child_result)
|
|
382
|
+
if child_result.shouldStop:
|
|
383
|
+
break
|
|
384
|
+
return result
|
|
385
|
+
finally:
|
|
386
|
+
# Kill the still active workers
|
|
387
|
+
pool.terminate()
|
|
388
|
+
pool.join()
|
|
389
|
+
|
|
390
|
+
def run(self, test):
|
|
391
|
+
self._test_list = _flatten_suite(test)
|
|
392
|
+
# This will call self._run_inner() on the created result object,
|
|
393
|
+
# and print out the detailed test results at the end.
|
|
394
|
+
return super(ParallelTestRunner, self).run(self._run_inner)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
try:
|
|
398
|
+
import faulthandler
|
|
399
|
+
except ImportError:
|
|
400
|
+
pass
|
|
401
|
+
else:
|
|
402
|
+
try:
|
|
403
|
+
# May fail in IPython Notebook with UnsupportedOperation
|
|
404
|
+
faulthandler.enable()
|
|
405
|
+
except BaseException as e:
|
|
406
|
+
msg = "Failed to enable faulthandler due to:\n{err}"
|
|
407
|
+
warnings.warn(msg.format(err=e))
|