##// END OF EJS Templates
switching to Popen to be python 2.6 friendly
slojo404 -
Show More
@@ -1,26 +1,28 b''
1 import os
1 import os
2 import errno
2 import errno
3 import os.path
3 import os.path
4 import subprocess
4 import subprocess
5 import nose.tools as nt
5 import nose.tools as nt
6
6
7 test_rst_fname = os.path.join('tests', 'tutorial.rst.ref')
7 test_rst_fname = os.path.join('tests', 'tutorial.rst.ref')
8 ref_ipynb_fname = os.path.join('tests', 'tutorial.ipynb.ref')
8 ref_ipynb_fname = os.path.join('tests', 'tutorial.ipynb.ref')
9 test_generate_ipynb_fname = os.path.join('tests', 'tutorial.ipynb')
9 test_generate_ipynb_fname = os.path.join('tests', 'tutorial.ipynb')
10
10
11
11
12 def clean_dir():
12 def clean_dir():
13 "Remove generated ipynb file created during conversion"
13 "Remove generated ipynb file created during conversion"
14 try:
14 try:
15 os.unlink(test_generate_ipynb_fname)
15 os.unlink(test_generate_ipynb_fname)
16 except OSError, e:
16 except OSError, e:
17 if e.errno != errno.ENOENT:
17 if e.errno != errno.ENOENT:
18 raise
18 raise
19
19
20
20
21 @nt.with_setup(clean_dir, clean_dir)
21 @nt.with_setup(clean_dir, clean_dir)
22 def test_command_line():
22 def test_command_line():
23 with open(ref_ipynb_fname, 'rb') as f:
23 with open(ref_ipynb_fname, 'rb') as f:
24 ref_output = f.read()
24 ref_output = f.read()
25 output = subprocess.check_output(['./rst2ipynb.py', test_rst_fname])
25 proc = subprocess.Popen(['./rst2ipynb.py', test_rst_fname],
26 stdout=subprocess.PIPE)
27 output = proc.communicate()[0]
26 nt.assert_equal(ref_output, output)
28 nt.assert_equal(ref_output, output)
General Comments 0
You need to be logged in to leave comments. Login now