Permalink
Browse files

update test due to recent changes in pyquickhelper

  • Loading branch information...
sdpython committed May 17, 2015
1 parent 4b30deb commit 503b5515fb698469829c03013365abc303cb2bc8
@@ -38,7 +38,7 @@
import pyquickhelper
from pyquickhelper import fLOG, get_temp_folder
from src.code_beatrix.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook
from src.code_beatrix.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook, unittest_raise_exception_notebook
class TestNotebookAlgorithm (unittest.TestCase):
@@ -55,13 +55,7 @@ def test_notebook_algorithm(self):
lambda i, n: "deviner" not in n,
fLOG=fLOG,
clean_function=clean_function_notebook)
assert len(res) > 0
fails = [(os.path.split(k)[-1], v)
for k, v in sorted(res.items()) if not v[0]]
for f in fails:
fLOG(f)
if len(fails) > 0:
raise fails[0][1][1]
unittest_raise_exception_notebook(res, fLOG)
if __name__ == "__main__":
unittest.main()
@@ -38,7 +38,7 @@
import pyquickhelper
from pyquickhelper import fLOG, get_temp_folder
from src.code_beatrix.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook
from src.code_beatrix.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook, unittest_raise_exception_notebook
class TestNotebookExample (unittest.TestCase):
@@ -55,13 +55,7 @@ def test_notebook_example(self):
lambda i, n: "deviner" not in n,
fLOG=fLOG,
clean_function=clean_function_notebook)
assert len(res) > 0
fails = [(os.path.split(k)[-1], v)
for k, v in sorted(res.items()) if not v[0]]
for f in fails:
fLOG(f)
if len(fails) > 0:
raise fails[0][1][1]
unittest_raise_exception_notebook(res, fLOG)
if __name__ == "__main__":
unittest.main()
@@ -154,3 +154,20 @@ def valid_cell(cell):
except Exception as e:
results[note] = (False, e)
return results
def unittest_raise_exception_notebook(res, fLOG):
"""
same code for all unit tests
@param res output of @see fn execute_notebooks
"""
assert len(res) > 0
fails = [(os.path.split(k)[-1], v[0], v[1])
for k, v in sorted(res.items()) if not v[0]]
for f in fails:
fLOG(f)
if len(fails) > 0:
raise fails[0][1][-1]
for k, v in sorted(res.items()):
fLOG("final", os.path.split(k)[-1], v[0], v[1])

0 comments on commit 503b551

Please sign in to comment.