Skip to content

Commit

Permalink
started FileProcessor : file interface : read, write, run ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
kangwonlee committed Dec 25, 2017
1 parent 31fe95a commit f928049
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions test_nbutils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import subprocess
import unittest

import ipynb_remove_output as nbutils
Expand All @@ -9,10 +8,11 @@
class TestNButils(unittest.TestCase):
def setUp(self):
self.input_file_name = 'sample.ipynb'
self.file_processor = nbutils.FileProcessor(self.input_file_name)

def test_sample_ipynb(self):
# should run without an exception
_exec_notebook(self.input_file_name)
self.file_processor.execute()

def test_read_notebook(self):
result = nbutils.read_file(self.input_file_name)
Expand Down Expand Up @@ -69,15 +69,6 @@ def test_replace_symbol(self):
self.assertSequenceEqual(expected, result)


def _exec_notebook(path):
# http://nbconvert.readthedocs.io/en/latest/execute_api.html
# ijstokes et al, Command line execution of a jupyter notebook fails in default Anaconda 4.1, https://github.com/Anaconda-Platform/nb_conda_kernels/issues/34
args = ["jupyter", "nbconvert", "--to", "notebook", "--execute",
"--ExecutePreprocessor.timeout=1000",
"--ExecutePreprocessor.kernel_name=python", path]
subprocess.check_call(args)


if __name__ == '__main__':
unittest.main()
# finished running

0 comments on commit f928049

Please sign in to comment.