Skip to content
Snippets Groups Projects
Commit 09549a7e authored by David Hendriks's avatar David Hendriks
Browse files

working on the notebook testcases

parent 9301f19a
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ from nbconvert.preprocessors import ExecutePreprocessor
from binarycpython.utils.functions import temp_dir
TMP_DIR = temp_dir('testing', 'test_notebooks')
NOTEBOOKS_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '../../../examples'))
def run_notebook(notebook_path):
"""
......@@ -45,11 +46,33 @@ class TestNotebook(unittest.TestCase):
Class that contains the notebook test calls
"""
def test_example(self):
notebook_name = 'example.ipynb'
nb, errors = run_notebook(notebook_name)
# def test_notebook_api_functionality(self):
# notebook_name = 'notebook_api_functionality.ipynb'
# full_notebook_path = os.path.join(NOTEBOOKS_DIR, notebook_name)
# nb, errors = run_notebook(full_notebook_path)
# msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors])
# self.assertEqual(errors, [], msg=msg)
# def test_notebook_population(self):
# notebook_name = 'notebook_population.ipynb'
# full_notebook_path = os.path.join(NOTEBOOKS_DIR, notebook_name)
# nb, errors = run_notebook(full_notebook_path)
# msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors])
# self.assertEqual(errors, [], msg=msg)
def test_notebook_individual_systems(self):
notebook_name = 'notebook_individual_systems.ipynb'
full_notebook_path = os.path.join(NOTEBOOKS_DIR, notebook_name)
nb, errors = run_notebook(full_notebook_path)
msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors])
self.assertEqual(errors, [], msg=msg)
# def test_notebook_extra_features(self):
# notebook_name = 'notebook_extra_features.ipynb'
# full_notebook_path = os.path.join(NOTEBOOKS_DIR, notebook_name)
# nb, errors = run_notebook(full_notebook_path)
# msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors])
# self.assertEqual(errors, [], msg=msg)
if __name__ == '__main__':
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment