@@ -11,6 +11,14 @@ def run_py(path):
11
11
orig_dir = os .getcwd ()
12
12
os .chdir (py_dir )
13
13
14
+ with open (path , 'r' ) as f :
15
+ content = f .read ()
16
+
17
+ with open (path , 'w' ) as f :
18
+ set_backend = "import matplotlib\n matplotlib.use('Agg')\n "
19
+ content = set_backend + content
20
+ f .write (content )
21
+
14
22
args = ["python" , py_path ]
15
23
subprocess .check_output (args )
16
24
@@ -19,11 +27,6 @@ def run_py(path):
19
27
20
28
class TestOptionalScripts (unittest .TestCase ):
21
29
22
- def test_ch01 (self ):
23
- this_dir = os .path .dirname (os .path .abspath (__file__ ))
24
- run_py (os .path .join (this_dir ,
25
- '../ch01/ch01.py' ))
26
-
27
30
def test_ch02 (self ):
28
31
this_dir = os .path .dirname (os .path .abspath (__file__ ))
29
32
run_py (os .path .join (this_dir ,
@@ -62,15 +65,6 @@ def test_ch08(self):
62
65
run_py (os .path .join (this_dir ,
63
66
'../ch08/ch08.py' ))
64
67
65
- def test_ch09 (self ):
66
- this_dir = os .path .dirname (os .path .abspath (__file__ ))
67
-
68
- # run only on Py3, because of the Py3 specific pickle files
69
- if (sys .version_info >= (3 , 0 )):
70
- run_py (os .path .join (this_dir , '../ch09/ch09.py' ))
71
- else :
72
- pass
73
-
74
68
def test_ch10 (self ):
75
69
this_dir = os .path .dirname (os .path .abspath (__file__ ))
76
70
run_py (os .path .join (this_dir ,
0 commit comments