Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
split LONG unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Sep 8, 2016
1 parent b894b0f commit 9cb9ac8
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 17 deletions.
Expand Up @@ -42,37 +42,23 @@
from pyquickhelper.pycode import get_temp_folder, add_missing_development_version


class TestNotebookRunner2a_3 (unittest.TestCase):
class TestNotebookRunner2a_3A_correction (unittest.TestCase):

def setUp(self):
add_missing_development_version(["pymyinstall", "pyensae", "pymmails"],
__file__, hide=True)

def test_notebook_runner_enonce(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook, clean_function_1a
temp = get_temp_folder(__file__, "temp_notebook2a_3_enonce")
keepnote = ls_notebooks("td2a")
assert len(keepnote) > 0
res = execute_notebooks(
temp, keepnote, lambda i, n: "_3" in n and "enonce" in n,
clean_function=clean_function_1a)
unittest_raise_exception_notebook(res, fLOG)

def test_notebook_runner_correction(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook, clean_function_1a
temp = get_temp_folder(__file__, "temp_notebook2a_3_correction")
temp = get_temp_folder(__file__, "temp_notebook2a_3A_correction")
keepnote = ls_notebooks("td2a")
assert len(keepnote) > 0
res = execute_notebooks(
temp, keepnote, lambda i, n: "_3" in n and "correction" in n,
temp, keepnote, lambda i, n: "_3A" in n and "correction" in n,
clean_function=clean_function_1a)
unittest_raise_exception_notebook(res, fLOG)

Expand Down
67 changes: 67 additions & 0 deletions _unittests/ut_notebooks/test_LONG_2A_notebook_3A_enonce.py
@@ -0,0 +1,67 @@
"""
@brief test log(time=620s)
notebook test
"""

import sys
import os
import unittest


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

try:
import pyquickhelper as skip_
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..",
"..",
"pyquickhelper",
"src")))
if path not in sys.path:
sys.path.append(path)
import pyquickhelper as skip_

from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, add_missing_development_version


class TestNotebookRunner2a_3A_enonce (unittest.TestCase):

def setUp(self):
add_missing_development_version(["pymyinstall", "pyensae", "pymmails"],
__file__, hide=True)

def test_notebook_runner_enonce(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook, clean_function_1a
temp = get_temp_folder(__file__, "temp_notebook2a_3A_enonce")
keepnote = ls_notebooks("td2a")
assert len(keepnote) > 0
res = execute_notebooks(
temp, keepnote, lambda i, n: "_3A" in n and "enonce" in n,
clean_function=clean_function_1a)
unittest_raise_exception_notebook(res, fLOG)


if __name__ == "__main__":
unittest.main()
66 changes: 66 additions & 0 deletions _unittests/ut_notebooks/test_LONG_2A_notebook_3B_correction.py
@@ -0,0 +1,66 @@
"""
@brief test log(time=620s)
notebook test
"""

import sys
import os
import unittest


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

try:
import pyquickhelper as skip_
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..",
"..",
"pyquickhelper",
"src")))
if path not in sys.path:
sys.path.append(path)
import pyquickhelper as skip_

from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, add_missing_development_version


class TestNotebookRunner2a_3B_correction (unittest.TestCase):

def setUp(self):
add_missing_development_version(["pymyinstall", "pyensae", "pymmails"],
__file__, hide=True)

def test_notebook_runner_correction(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook, clean_function_1a
temp = get_temp_folder(__file__, "temp_notebook2a_3B_correction")
keepnote = ls_notebooks("td2a")
assert len(keepnote) > 0
res = execute_notebooks(
temp, keepnote, lambda i, n: "_3B" in n and "correction" in n,
clean_function=clean_function_1a)
unittest_raise_exception_notebook(res, fLOG)

if __name__ == "__main__":
unittest.main()
67 changes: 67 additions & 0 deletions _unittests/ut_notebooks/test_LONG_2A_notebook_3B_enonce.py
@@ -0,0 +1,67 @@
"""
@brief test log(time=620s)
notebook test
"""

import sys
import os
import unittest


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

try:
import pyquickhelper as skip_
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..",
"..",
"pyquickhelper",
"src")))
if path not in sys.path:
sys.path.append(path)
import pyquickhelper as skip_

from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, add_missing_development_version


class TestNotebookRunner2a_3B_enonce (unittest.TestCase):

def setUp(self):
add_missing_development_version(["pymyinstall", "pyensae", "pymmails"],
__file__, hide=True)

def test_notebook_runner_enonce(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook, clean_function_1a
temp = get_temp_folder(__file__, "temp_notebook2a_3B_enonce")
keepnote = ls_notebooks("td2a")
assert len(keepnote) > 0
res = execute_notebooks(
temp, keepnote, lambda i, n: "_3B" in n and "enonce" in n,
clean_function=clean_function_1a)
unittest_raise_exception_notebook(res, fLOG)


if __name__ == "__main__":
unittest.main()

0 comments on commit 9cb9ac8

Please sign in to comment.