module automation.notebook_test_helper
#
Short summary#
module ensae_teaching_cs.automation.notebook_test_helper
Some automation helpers to test notebooks and check they are still working fine.
Functions#
function |
truncated documentation |
---|---|
Runs and tests a specific list of notebooks. The function raises an exception if the execution fails. |
|
Function which cleans cells when unittesting notebooks 1A. |
|
Copies a data file from a notebook folder to the current folder. |
|
Executes a list of notebooks. |
|
Returns a list of paths to add before running the notebooks, paths to pyquickhelper, pyensae, pymmails. … |
|
Lists the notebooks in a particular subfolder. |
Documentation#
Some automation helpers to test notebooks and check they are still working fine.
- ensae_teaching_cs.automation.notebook_test_helper.a_test_notebook_runner(filename, name, folder, valid=None, copy_files=None, modules=None, fLOG=<function noLOG>)#
Runs and tests a specific list of notebooks. The function raises an exception if the execution fails.
- Paramètres:
filename – test filename
name – substring to look into notebook filenames
folder – where to look for notebooks
valid – skip cells if valid is False, None for all valid
copy_files – files to copy before running the notebooks.
modules – list of extra dependencies
fLOG – logging function
- ensae_teaching_cs.automation.notebook_test_helper.clean_function_1a(code)#
Function which cleans cells when unittesting notebooks 1A.
- Paramètres:
code – cell content
- Renvoie:
modified code
- ensae_teaching_cs.automation.notebook_test_helper.copy_data_file(notebook_folder, filename, dest, fLOG=<function noLOG>)#
Copies a data file from a notebook folder to the current folder.
- Paramètres:
notebook_folder – notebook_folder
filename – filename or list of file names
dest – destination folder
@parm fLOG logging function
- Renvoie:
copied files
- ensae_teaching_cs.automation.notebook_test_helper.execute_notebooks(folder, notebooks, filter, clean_function=None, fLOG=<function noLOG>, deepfLOG=<function noLOG>, replacements=None, dump=None, additional_path=None)#
Executes a list of notebooks.
- Paramètres:
folder – folder
notebooks – list of notebooks
filter – function which validates the notebooks to test (True means will be tested)
clean_function – cleaning function to apply to the code before running it
fLOG – logging function
deepfLOG – logging function used to run the notebook
replacements – replacements
dump – see function execute_notebook_list_finalize_ut
additional_path – additional path to add
- Renvoie:
dictionary { notebook_file: (isSuccess, outout) }
The signature of function
filter
is:def filter(i, filename): return True or False
- ensae_teaching_cs.automation.notebook_test_helper.get_additional_paths()#
Returns a list of paths to add before running the notebooks, paths to pyquickhelper, pyensae, pymmails.
- Renvoie:
list of paths
- ensae_teaching_cs.automation.notebook_test_helper.ls_notebooks(subfolder)#
Lists the notebooks in a particular subfolder.
- Paramètres:
subfolder – subfolder (related to this module)
- Renvoie:
list of files