papermill.tests package

Submodules

papermill.tests.test_abs module

class papermill.tests.test_abs.ABSTest(methodName='runTest')

Bases: unittest.case.TestCase

Tests for ABS

setUp()

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

test_blob_service_client()
test_listdir_calls()
test_reads_file(mockBytesIO)
test_split_url_raises_exception_on_invalid_url()
test_split_url_splits_valid_url()
test_write_file()
class papermill.tests.test_abs.MockBytesIO

Bases: object

seek(seed)

papermill.tests.test_adl module

class papermill.tests.test_adl.ADLTest(methodName='runTest')

Bases: unittest.case.TestCase

Tests for ADL

setUp()

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

test_create_adapter(azure_dl_filesystem_mock, auth_mock)
test_listdir_calls_ls_on_adl_adapter()
test_read_opens_and_reads_file()
test_split_url_raises_exception_on_invalid_url()
test_split_url_splits_valid_url()
test_write_opens_file_and_writes_to_it()

papermill.tests.test_autosave module

class papermill.tests.test_autosave.TestMidCellAutosave(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

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

test_autosave_disable()
test_autosave_not_too_fast()
test_end2end_autosave_slow_notebook()

papermill.tests.test_cli module

Test the command line interface

class papermill.tests.test_cli.TestCLI(methodName='runTest')

Bases: unittest.case.TestCase

augment_execute_kwargs(**new_kwargs)
default_execute_kwargs = {'autosave_cell_every': 30, 'cwd': None, 'engine_name': None, 'execution_timeout': None, 'input_path': 'input.ipynb', 'kernel_name': None, 'log_output': False, 'output_path': 'output.ipynb', 'parameters': {}, 'prepare_only': False, 'progress_bar': True, 'report_mode': False, 'request_save_on_cell_execute': True, 'start_timeout': 60, 'stderr_file': None, 'stdout_file': None}
setUp()

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

test_engine(execute_patch)
test_execution_timeout(execute_patch)
test_inject_input_path(execute_patch)
test_inject_output_path(execute_patch)
test_inject_paths(execute_patch)
test_kernel(execute_patch)
test_log_level(execute_patch)
test_log_output(execute_patch)
test_log_output_plus_progress(execute_patch)
test_many_args(execute_patch)
test_no_log_output(execute_patch)
test_no_progress_bar(execute_patch)
test_no_report_mode(execute_patch)
test_parameters(execute_patch)
test_parameters_base64(execute_patch)
test_parameters_base64_date(execute_patch)
test_parameters_dead_kernel(execute_patch)
test_parameters_file(execute_patch)
test_parameters_raw(execute_patch)
test_parameters_yaml(execute_patch)
test_parameters_yaml_date(execute_patch)
test_parameters_yaml_override(execute_patch)
test_prepare_only(execute_patch)
test_progress_bar(execute_patch)
test_report_mode(execute_patch)
test_set_cwd(execute_patch)
test_start_timeout(execute_patch)
test_start_timeout_backwards_compatibility(execute_patch)
test_version(execute_patch)
papermill.tests.test_cli.notebook()
papermill.tests.test_cli.papermill_cli(papermill_args=None, **kwargs)
papermill.tests.test_cli.papermill_version()
papermill.tests.test_cli.test_is_float(value, expected)
papermill.tests.test_cli.test_is_int(value, expected)
papermill.tests.test_cli.test_pipe_in_auto(tmpdir, notebook)
papermill.tests.test_cli.test_pipe_in_explicit(tmpdir, notebook)
papermill.tests.test_cli.test_pipe_in_out_auto(notebook)
papermill.tests.test_cli.test_pipe_in_out_explicit(notebook)
papermill.tests.test_cli.test_pipe_out_auto(tmpdir, notebook)
papermill.tests.test_cli.test_pipe_out_explicit(tmpdir, notebook)
papermill.tests.test_cli.test_resolve_type(test_input, expected)
papermill.tests.test_cli.test_stdout_file(tmpdir)

papermill.tests.test_clientwrap module

class papermill.tests.test_clientwrap.TestPapermillClientWrapper(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_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 applied 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.TestNBClientEngine(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_markdown_code()
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.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_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_hdfs module

class papermill.tests.test_hdfs.HDFSTest(methodName='runTest')

Bases: unittest.case.TestCase

setUp()

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

test_hdfs_listdir(mock_hdfs_filesystem)
test_hdfs_read(mock_hdfs_filesystem)
test_hdfs_write(mock_hdfs_filesystem)
class papermill.tests.test_hdfs.MockHadoopFile

Bases: object

read()
write(new_content)
class papermill.tests.test_hdfs.MockHadoopFileSystem(*args, **kw)

Bases: unittest.mock.MagicMock

ls(path)
open(path, *args)

papermill.tests.test_iorw module

class papermill.tests.test_iorw.TestADLHandler(methodName='runTest')

Bases: unittest.case.TestCase

Tests for ADLHandler

setUp()

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

test_listdir()
test_read()
test_write()
class papermill.tests.test_iorw.TestHttpHandler(methodName='runTest')

Bases: unittest.case.TestCase

Tests for HttpHandler.

test_listdir()

Tests that listdir raises PapermillException saying that that listdir function is not supported.

test_read()

Tests that the read function performs a request to the giving path and returns the response.

test_write()

Tests that the write function performs a put request to the given path.

test_write_failure()

Tests that the write function raises on failure to put the buffer.

class papermill.tests.test_iorw.TestLocalHandler(methodName='runTest')

Bases: unittest.case.TestCase

Tests for LocalHandler

test_invalid_string()
test_local_file_io_cwd()
test_read_from_string()
test_read_utf8()
test_write_local_directory()
test_write_no_directory_exists()
test_write_passed_cwd()
test_write_utf8()
class papermill.tests.test_iorw.TestPapermillIO(methodName='runTest')

Bases: unittest.case.TestCase

Tests for PapermillIO.

class FakeByteHandler(ver)

Bases: object

listdir(path)
pretty_path(path)
read(path)
write(buf, path)
class FakeHandler(ver)

Bases: object

listdir(path)
pretty_path(path)
read(path)
write(buf, path)
setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_entrypoint_register()
test_get_handler()
test_get_local_handler()
test_listdir()
test_pretty_path()
test_read()
test_read_bytes()
test_read_stdin()
test_read_with_invalid_file_extension()
test_read_with_no_file_extension()
test_read_with_valid_file_extension()
test_read_yaml_with_invalid_file_extension()
test_read_yaml_with_no_file_extension()
test_register_ordering()
test_write()
test_write_stdout()
test_write_with_invalid_file_extension()
test_write_with_no_file_extension()

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_s3 module

papermill.tests.test_s3.bucket_ec2()

Returns a bucket instance with a ec2 service

papermill.tests.test_s3.bucket_multiservice()

Returns a bucket instance with a ec2 service

papermill.tests.test_s3.bucket_no_service()

Returns a bucket instance with no services

papermill.tests.test_s3.bucket_sqs()

Returns a bucket instance with a sqs service

papermill.tests.test_s3.bucket_with_service()

Returns a bucket instance with a service

papermill.tests.test_s3.no_empty_lines(s)
papermill.tests.test_s3.read_from_gen(g)
papermill.tests.test_s3.s3_client()
papermill.tests.test_s3.test_bucket_defaults()
papermill.tests.test_s3.test_bucket_init()
papermill.tests.test_s3.test_bucket_list(bucket_sqs)
papermill.tests.test_s3.test_bucket_missing_params()
papermill.tests.test_s3.test_key_defaults()
papermill.tests.test_s3.test_key_init()
papermill.tests.test_s3.test_key_repr()
papermill.tests.test_s3.test_prefix_defaults()
papermill.tests.test_s3.test_prefix_init()
papermill.tests.test_s3.test_prefix_repr(bucket_sqs)
papermill.tests.test_s3.test_prefix_str(bucket_sqs)
papermill.tests.test_s3.test_s3_defaults()
papermill.tests.test_s3.test_s3_listdir(s3_client)
papermill.tests.test_s3.test_s3_overwrite(s3_client)
papermill.tests.test_s3.test_s3_read(s3_client)
papermill.tests.test_s3.test_s3_write(s3_client)

papermill.tests.test_translators module

papermill.tests.test_translators.test_find_translator_with_exact_kernel_name()
papermill.tests.test_translators.test_find_translator_with_exact_language()
papermill.tests.test_translators.test_find_translator_with_no_such_kernel_or_language()
papermill.tests.test_translators.test_translate_assign_csharp(input_name, input_value, expected)
papermill.tests.test_translators.test_translate_assign_fsharp(input_name, input_value, expected)
papermill.tests.test_translators.test_translate_assign_scala(input_name, input_value, expected)
papermill.tests.test_translators.test_translate_codify_csharp(parameters, expected)
papermill.tests.test_translators.test_translate_codify_fsharp(parameters, expected)
papermill.tests.test_translators.test_translate_codify_julia(parameters, expected)
papermill.tests.test_translators.test_translate_codify_matlab(parameters, expected)
papermill.tests.test_translators.test_translate_codify_python(parameters, expected)
papermill.tests.test_translators.test_translate_codify_r(parameters, expected)
papermill.tests.test_translators.test_translate_codify_scala(parameters, expected)
papermill.tests.test_translators.test_translate_comment_csharp(test_input, expected)
papermill.tests.test_translators.test_translate_comment_fsharp(test_input, expected)
papermill.tests.test_translators.test_translate_comment_julia(test_input, expected)
papermill.tests.test_translators.test_translate_comment_matlab(test_input, expected)
papermill.tests.test_translators.test_translate_comment_python(test_input, expected)
papermill.tests.test_translators.test_translate_comment_r(test_input, expected)
papermill.tests.test_translators.test_translate_comment_scala(test_input, expected)
papermill.tests.test_translators.test_translate_type_csharp(test_input, expected)
papermill.tests.test_translators.test_translate_type_fsharp(test_input, expected)
papermill.tests.test_translators.test_translate_type_julia(test_input, expected)
papermill.tests.test_translators.test_translate_type_matlab(test_input, expected)
papermill.tests.test_translators.test_translate_type_python(test_input, expected)
papermill.tests.test_translators.test_translate_type_r(test_input, expected)
papermill.tests.test_translators.test_translate_type_scala(test_input, expected)
papermill.tests.test_translators.test_translate_uses_str_representation_of_unknown_types()
papermill.tests.test_translators.test_translator_must_implement_comment()
papermill.tests.test_translators.test_translator_must_implement_translate_dict()
papermill.tests.test_translators.test_translator_must_implement_translate_list()

papermill.tests.test_utils module

papermill.tests.test_utils.test_chdir()
papermill.tests.test_utils.test_merge_kwargs()
papermill.tests.test_utils.test_remove_args()
papermill.tests.test_utils.test_retry()

Module contents

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