Permalink
Browse files

split a unit test

  • Loading branch information...
sdpython committed May 23, 2018
1 parent 8c961aa commit 2e03c3114a01b72f7b4b67cc636bf4e924cb38ea
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
@brief test log(time=58s)
@brief test log(time=10s)
"""
import sys
@@ -62,7 +62,7 @@ def clean(cell):
clean = clean_function_notebook
res = execute_notebooks(temp, keepnote,
lambda i, n: "poppins" not in n,
lambda i, n: "poppins" not in n and "video" not in n,
fLOG=fLOG, clean_function=clean)
execute_notebook_list_finalize_ut(
res, fLOG=fLOG, dump=src.code_beatrix)
@@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
"""
@brief test log(time=13s)
"""
import sys
import os
import unittest
import shutil
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, add_missing_development_version, is_travis_or_appveyor
from pyquickhelper.ipythonhelper import execute_notebook_list_finalize_ut
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src
from src.code_beatrix.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_notebook
import src.code_beatrix
class TestNotebookExampleVideo (unittest.TestCase):
def setUp(self):
add_missing_development_version(
["pyensae", "jyquickhelper", "ensae_projects"], __file__)
def test_notebook_example_video(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_exemples_video")
keepnote = ls_notebooks("exemples")
self.assertTrue(len(keepnote) > 0)
source = os.path.join(os.path.dirname(keepnote[0]), "data")
images = os.path.join(temp, 'data')
os.mkdir(images)
for img in os.listdir(source):
shutil.copy(os.path.join(source, img), images)
if is_travis_or_appveyor() == "circleci":
def clean(cell):
cell = clean_function_notebook(cell)
# ValueError: Cannot embed the 'gif' image format (circleci)
cell = cell.replace('Image("video.gif")',
'# Image("video.gif")')
return cell
else:
clean = clean_function_notebook
res = execute_notebooks(temp, keepnote,
lambda i, n: "video" in n,
fLOG=fLOG, clean_function=clean)
execute_notebook_list_finalize_ut(
res, fLOG=fLOG, dump=src.code_beatrix)
if __name__ == "__main__":
unittest.main()

0 comments on commit 2e03c31

Please sign in to comment.