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.

source on GitHub

Functions

function

truncated documentation

a_test_notebook_runner

Runs and tests a specific list of notebooks. The function raises an exception if the execution fails.

clean_function_1a

Function which cleans cells when unittesting notebooks 1A.

copy_data_file

Copies a data file from a notebook folder to the current folder.

execute_notebooks

Executes a list of notebooks.

get_additional_paths

Returns a list of paths to add before running the notebooks, paths to pyquickhelper, pyensae, pymmails. …

ls_notebooks

Lists the notebooks in a particular subfolder.

Documentation

Some automation helpers to test notebooks and check they are still working fine.

source on GitHub

ensae_teaching_cs.automation.notebook_test_helper.a_test_notebook_runner(filename, name, folder, valid=None, copy_files=None, modules=None, fLOG=<function noLOG>)[source]

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

source on GitHub

ensae_teaching_cs.automation.notebook_test_helper.clean_function_1a(code)[source]

Function which cleans cells when unittesting notebooks 1A.

Paramètres

code – cell content

Renvoie

modified code

source on GitHub

ensae_teaching_cs.automation.notebook_test_helper.copy_data_file(notebook_folder, filename, dest, fLOG=<function noLOG>)[source]

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

source on GitHub

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)[source]

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

source on GitHub

ensae_teaching_cs.automation.notebook_test_helper.get_additional_paths()[source]

Returns a list of paths to add before running the notebooks, paths to pyquickhelper, pyensae, pymmails.

Renvoie

list of paths

source on GitHub

ensae_teaching_cs.automation.notebook_test_helper.ls_notebooks(subfolder)[source]

Lists the notebooks in a particular subfolder.

Paramètres

subfolder – subfolder (related to this module)

Renvoie

list of files

source on GitHub