forked from statsmodels/statsmodels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_all.py
54 lines (42 loc) · 1.62 KB
/
run_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""run all examples to make sure we don't get an exception
Note:
If an example contaings plt.show(), then all plot windows have to be closed
manually, at least in my setup.
uncomment plt.show() to show all plot windows
"""
stop_on_error = True
filelist = ['example_glsar.py', 'example_wls.py', 'example_gls.py',
'example_glm.py', 'example_ols_tftest.py', # 'example_rpy.py',
'example_ols.py', 'example_rlm.py',
'example_discrete.py', 'example_predict.py',
'example_ols_table.py',
# time series
'tsa/ex_arma2.py', 'tsa/ex_dates.py']
if __name__ == '__main__':
#temporarily disable show
import matplotlib.pyplot as plt
plt_show = plt.show
def noop(*args):
pass
plt.show = noop
msg = """Are you sure you want to run all of the examples?
This is done mainly to check that they are up to date.
(y/n) >>> """
cont = raw_input(msg)
if 'y' in cont.lower():
for run_all_f in filelist:
try:
print '\n\nExecuting example file', run_all_f
print '-----------------------' + '-' * len(run_all_f)
execfile(run_all_f)
except:
# f might be overwritten in the executed file
print '**********************' + '*' * len(run_all_f)
print 'ERROR in example file', run_all_f
print '**********************' + '*' * len(run_all_f)
if stop_on_error:
raise
# reenable show after closing windows
plt.close('all')
plt.show = plt_show
plt.show()