comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/f2py/f2py_testing.py @ 87:2a2c65a20a8b

Add Python libs and headers
author Chris Cannam
date Wed, 25 Feb 2015 14:05:22 +0000
parents
children
comparison
equal deleted inserted replaced
86:413a9d26189e 87:2a2c65a20a8b
1 from __future__ import division, absolute_import, print_function
2
3 import sys
4 import re
5
6 from numpy.testing.utils import jiffies, memusage
7
8 def cmdline():
9 m=re.compile(r'\A\d+\Z')
10 args = []
11 repeat = 1
12 for a in sys.argv[1:]:
13 if m.match(a):
14 repeat = eval(a)
15 else:
16 args.append(a)
17 f2py_opts = ' '.join(args)
18 return repeat, f2py_opts
19
20 def run(runtest,test_functions,repeat=1):
21 l = [(t, repr(t.__doc__.split('\n')[1].strip())) for t in test_functions]
22 #l = [(t,'') for t in test_functions]
23 start_memusage = memusage()
24 diff_memusage = None
25 start_jiffies = jiffies()
26 i = 0
27 while i<repeat:
28 i += 1
29 for t, fname in l:
30 runtest(t)
31 if start_memusage is None: continue
32 if diff_memusage is None:
33 diff_memusage = memusage() - start_memusage
34 else:
35 diff_memusage2 = memusage() - start_memusage
36 if diff_memusage2!=diff_memusage:
37 print('memory usage change at step %i:' % i,\
38 diff_memusage2-diff_memusage,\
39 fname)
40 diff_memusage = diff_memusage2
41 current_memusage = memusage()
42 print('run', repeat*len(test_functions), 'tests',\
43 'in %.2f seconds' % ((jiffies()-start_jiffies)/100.0))
44 if start_memusage:
45 print('initial virtual memory size:', start_memusage, 'bytes')
46 print('current virtual memory size:', current_memusage, 'bytes')