papermill.tests package

Submodules

papermill.tests.test_abs module

papermill.tests.test_adl module

papermill.tests.test_cli module

papermill.tests.test_conf module

papermill.tests.test_engines module

papermill.tests.test_engines.AnyMock(cls)

Mocks a matcher for any instance of class cls. e.g. my_mock.called_once_with(Any(int), “bar”)

class papermill.tests.test_engines.TestEngineBase(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_cell_callback_execute()
test_no_cell_callback_execute()
test_wrap_and_execute_notebook()

Mocks each wrapped call and proves the correct inputs get applies to the correct underlying calls for execute_notebook.

class papermill.tests.test_engines.TestEngineRegistration(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_getting()
test_registering_entry_points()
test_registration()
class papermill.tests.test_engines.TestNBConvertEngine(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_nb_convert_engine()
test_nb_convert_engine_execute()
test_nb_convert_log_outputs()
test_nb_convert_no_log_outputs()
class papermill.tests.test_engines.TestNotebookExecutionManager(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_basic_pbar()
test_cell_complete_after_cell_exception()
test_cell_complete_after_cell_start()
test_cell_complete_new_nb()
test_cell_complete_without_cell_start()
test_cell_exception()
test_cell_exception_new_nb()
test_cell_start()
test_cell_start_new_nb()
test_nb_isolation()

Tests that the engine notebook is isolated from source notebook

test_no_pbar()
test_notebook_complete()
test_notebook_complete_cell_status_completed()
test_notebook_complete_cell_status_with_failed()
test_notebook_complete_new_nb()
test_notebook_start()
test_notebook_start_new_nb()
test_save()
test_save_new_nb()
test_save_no_output()
test_set_timer()

papermill.tests.test_exceptions module

papermill.tests.test_execute module

class papermill.tests.test_execute.TestBrokenNotebook1(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test()
class papermill.tests.test_execute.TestBrokenNotebook2(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test()
class papermill.tests.test_execute.TestCWD(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_execution_respects_cwd_assignment()
test_local_save_ignores_cwd_assignment()
class papermill.tests.test_execute.TestNBConvertCalls(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_convert_output_to_html()
class papermill.tests.test_execute.TestNotebookHelpers(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_backslash_params()
test_backslash_quote_params()
test_cell_insertion()
test_default_start_timeout(preproc_mock)
test_double_backslash_quote_params()
test_no_tags()
test_prepare_only()
test_quoted_params()
test_start_timeout(preproc_mock)
class papermill.tests.test_execute.TestReportMode(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_report_mode()
class papermill.tests.test_execute.TestSysExit(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_sys_exit()
test_sys_exit0()
test_sys_exit1()
papermill.tests.test_execute.execute_notebook(input_path, output_path, parameters=None, engine_name=None, request_save_on_cell_execute=True, prepare_only=False, *, kernel_name='python3', progress_bar=True, log_output=False, stdout_file=None, stderr_file=None, start_timeout=60, report_mode=False, cwd=None, **engine_kwargs)

Executes a single notebook locally.

Parameters:
  • input_path (str) – Path to input notebook
  • output_path (str) – Path to save executed notebook
  • parameters (dict, optional) – Arbitrary keyword arguments to pass to the notebook parameters
  • engine_name (str, optional) – Name of execution engine to use
  • request_save_on_cell_execute (bool, optional) – Request save notebook after each cell execution
  • prepare_only (bool, optional) – Flag to determine if execution should occur or not
  • kernel_name (str, optional) – Name of kernel to execute the notebook against
  • progress_bar (bool, optional) – Flag for whether or not to show the progress bar.
  • log_output (bool, optional) – Flag for whether or not to write notebook output to the configured logger
  • start_timeout (int, optional) – Duration in seconds to wait for kernel start-up
  • report_mode (bool, optional) – Flag for whether or not to hide input.
  • cwd (str, optional) – Working directory to use when executing the notebook
  • **kwargs – Arbitrary keyword arguments to pass to the notebook engine
Returns:

nb – Executed notebook object

Return type:

NotebookNode

papermill.tests.test_gcs module

class papermill.tests.test_gcs.GCSTest(methodName='runTest')

Bases: unittest.case.TestCase

Tests for GCS.

setUp()

Hook method for setting up the test fixture before exercising it.

test_fallback_gcs_invalid_code(mock_gcs_filesystem, mock_gcs_retriable)
test_gcs_fallback_retry_unknown_failure_code(mock_gcs_filesystem, mock_gcs_retriable)
test_gcs_handle_exception(mock_gcs_filesystem)
test_gcs_invalid_code(mock_gcs_filesystem, mock_gcs_retriable)
test_gcs_listdir(mock_gcs_filesystem)
test_gcs_read(mock_gcs_filesystem)
test_gcs_retry(mock_gcs_filesystem)
test_gcs_retry_older_exception(mock_gcs_filesystem)
test_gcs_unretryable(mock_gcs_filesystem)
test_gcs_write(mock_gcs_filesystem)
class papermill.tests.test_gcs.MockGCSFile(exception=None, max_raises=1)

Bases: object

read()
write(buf)
papermill.tests.test_gcs.mock_gcs_fs_wrapper(exception=None, max_raises=1)

papermill.tests.test_iorw module

papermill.tests.test_parameterize module

class papermill.tests.test_parameterize.TestBuiltinParameters(methodName='runTest')

Bases: unittest.case.TestCase

test_add_builtin_parameters_adds_dict_of_builtins()
test_add_builtin_parameters_allows_to_override_builtin()
test_add_builtin_parameters_keeps_provided_parameters()
test_builtin_parameters_include_current_datetime_local()
test_builtin_parameters_include_current_datetime_utc()
test_builtin_parameters_include_run_uuid()
class papermill.tests.test_parameterize.TestNotebookParametrizing(methodName='runTest')

Bases: unittest.case.TestCase

count_nb_injected_parameter_cells(nb)
test_injected_parameters_tag()
test_no_parameter_tag()
test_no_tag_copying()
test_repeated_run_injected_parameters_tag()
test_repeated_run_no_parameters_tag()
class papermill.tests.test_parameterize.TestPathParameterizing(methodName='runTest')

Bases: unittest.case.TestCase

test_parameterized_path_with_none_parameters()
test_parameterized_path_with_undefined_parameter()
test_path_with_boolean_parameter()
test_path_with_dict_parameter()
test_path_with_float_format_string()
test_path_with_list_parameter()
test_path_with_multiple_parameter()
test_path_with_none_parameter()
test_path_with_numeric_format_string()
test_path_with_numeric_parameter()
test_path_with_single_parameter()
test_plain_text_path_with_empty_parameters_object()
test_plain_text_path_with_none_parameters()
test_plain_text_path_with_unused_parameters()

papermill.tests.test_preprocessor module

class papermill.tests.test_preprocessor.TestPapermillExecutePreprocessor(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_logging_data_msg()
test_logging_stderr_msg()
test_logging_stdout_msg()

papermill.tests.test_s3 module

papermill.tests.test_translators module

papermill.tests.test_utils module

Module contents

papermill.tests.get_notebook_dir(*args)
papermill.tests.get_notebook_path(*args)