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