def test_simple_fail(self): directory = os.path.sep.join( os.path.abspath(__file__).split(os.path.sep)[:-1] + ['notebooks', 'failing_notebooks']) Test = testipynb.TestNotebooks(directory=directory) self.assertTrue(Test.run_tests())
def test_skipping_notebooks(self): directory = os.path.sep.join( os.path.abspath(__file__).split(os.path.sep)[:-1] + ['notebooks']) Test = testipynb.TestNotebooks( directory=directory, ignore=["failing_notebook", "failing_notebook2"]) self.assertTrue(Test.run_tests())
def test_class_attributes(self): directory = os.path.sep.join( os.path.abspath(__file__).split(os.path.sep)[:-1] + ['notebooks', 'passing_notebooks']) Test = testipynb.TestNotebooks(directory=directory) nbnames = ['HelloWorld', 'notebook_that_loads_things'] self.assertTrue(sorted(Test._nbnames) == sorted(nbnames)) self.assertTrue( sorted(Test._nbpaths) == sorted([ directory + os.path.sep + "{}.ipynb".format(nb) for nb in nbnames ]))
import os import numpy as np import testipynb import unittest NBDIR = os.path.sep.join(os.path.abspath(__file__).split(os.path.sep)[:-2]) IGNORE = [] Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2800) test_nbnames = [t for t in Test._nbnames if t not in IGNORE] Test.ignore = IGNORE TestNotebooks = Test.get_tests() if __name__ == "__main__": unittest.main()
def test_notebooks(self): Test = testipynb.TestNotebooks(directory=NBDIR, timeout=1800) self.assertTrue(Test.run_tests())
import os import testipynb import unittest import numpy as np NBDIR = os.path.sep.join( os.path.abspath(__file__).split(os.path.sep)[:-2] + ['appendix-notebooks']) IGNORE = ["DC_Flawed_Steel_Cased_Wells_Geologic_Noise"] Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2800, ignore=IGNORE) TestNotebooks = Test.get_tests() if __name__ == "__main__": unittest.main()