##// END OF EJS Templates
switching to Popen to be python 2.6 friendly
switching to Popen to be python 2.6 friendly

File last commit:

r6291:1c214941
r6291:1c214941
Show More
test_rst2ipynb.py
28 lines | 808 B | text/x-python | PythonLexer
/ tests / test_rst2ipynb.py
slojo404
adding a basic test and moving tutorial.rst test file to tests directory
r6288 import os
import errno
slojo404
clean up
r6289 import os.path
slojo404
adding a basic test and moving tutorial.rst test file to tests directory
r6288 import subprocess
import nose.tools as nt
slojo404
clean up
r6289 test_rst_fname = os.path.join('tests', 'tutorial.rst.ref')
ref_ipynb_fname = os.path.join('tests', 'tutorial.ipynb.ref')
test_generate_ipynb_fname = os.path.join('tests', 'tutorial.ipynb')
slojo404
adding a basic test and moving tutorial.rst test file to tests directory
r6288
def clean_dir():
"Remove generated ipynb file created during conversion"
try:
os.unlink(test_generate_ipynb_fname)
except OSError, e:
if e.errno != errno.ENOENT:
raise
@nt.with_setup(clean_dir, clean_dir)
def test_command_line():
with open(ref_ipynb_fname, 'rb') as f:
ref_output = f.read()
slojo404
switching to Popen to be python 2.6 friendly
r6291 proc = subprocess.Popen(['./rst2ipynb.py', test_rst_fname],
stdout=subprocess.PIPE)
output = proc.communicate()[0]
slojo404
adding a basic test and moving tutorial.rst test file to tests directory
r6288 nt.assert_equal(ref_output, output)