Skip to content

Commit

Permalink
split unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Apr 21, 2018
1 parent db4ddd4 commit f99e1bd
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 9 deletions.
8 changes: 6 additions & 2 deletions HISTORY.rst
@@ -1,14 +1,18 @@

.. _l-HISTORY:

=======
History
=======

current - 2018-03-31 - 0.00Mb
current - 2018-04-21 - 0.00Mb
=============================

* `7`: talk about serialization (2018-04-20)
* `5`: fix .. only:: html in readme.rst (2018-03-29)

0.1.175 - 2017-10-05 - 0.02Mb
0.1.175 - 2017-10-05 - 6.43Mb
=============================

* `2`: finish the migration of latex (2017-06-10)
* `1`: completed completion (2016-09-25)
8 changes: 1 addition & 7 deletions _unittests/ut_documentation/test_run_notebooks_python.py
Expand Up @@ -63,17 +63,11 @@ def test_run_notebook_python(self):
os.path.abspath(os.path.dirname(__file__)), "..", "..", "_doc", "notebooks", "python"))
keepnote = []
for f in os.listdir(fnb):
if os.path.splitext(f)[-1] == ".ipynb" and "_long" not in f:
if os.path.splitext(f)[-1] == ".ipynb" and "_long" not in f and "protobuf" not in f:
keepnote.append(os.path.join(fnb, f))

# function to tell that a can be run
def valid(cell):
if "open_html_form" in cell:
return False
if "open_window_params" in cell:
return False
if '<div style="position:absolute' in cell:
return False
return True

# additionnal path to add
Expand Down
90 changes: 90 additions & 0 deletions _unittests/ut_documentation/test_run_notebooks_python_protobuf.py
@@ -0,0 +1,90 @@
# -*- coding: utf-8 -*-
"""
@brief test log(time=67s)
"""

import sys
import os
import unittest


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_


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 pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, is_travis_or_appveyor
from pyquickhelper.ipythonhelper import execute_notebook_list, execute_notebook_list_finalize_ut
from pyquickhelper.ipythonhelper import install_python_kernel_for_unittest
import src.teachpyx


class TestRunNotebooksPythonProtobuf(unittest.TestCase):

def test_run_notebook_python_protobuf(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")

kernel_name = None if is_travis_or_appveyor() else install_python_kernel_for_unittest(
"python3_module_template")

temp = get_temp_folder(__file__, "temp_run_notebooks_python_protobuf")

# selection of notebooks
fnb = os.path.normpath(os.path.join(
os.path.abspath(os.path.dirname(__file__)), "..", "..", "_doc", "notebooks", "python"))
keepnote = []
for f in os.listdir(fnb):
if os.path.splitext(f)[-1] == ".ipynb" and "protobuf" in f:
keepnote.append(os.path.join(fnb, f))

# function to tell that a can be run
def valid(cell):
return True

# additionnal path to add
addpaths = [os.path.normpath(os.path.join(
os.path.abspath(os.path.dirname(__file__)), "..", "..", "src")),
os.path.normpath(os.path.join(
os.path.abspath(os.path.dirname(__file__)), "..", "..", "..", "pyquickhelper", "src")),
os.path.normpath(os.path.join(
os.path.abspath(os.path.dirname(__file__)), "..", "..", "..", "jyquickhelper", "src"))
]

# run the notebooks
res = execute_notebook_list(
temp, keepnote, fLOG=fLOG, valid=valid, additional_path=addpaths, kernel_name=kernel_name)
execute_notebook_list_finalize_ut(
res, fLOG=fLOG, dump=src.teachpyx)


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

0 comments on commit f99e1bd

Please sign in to comment.