Пример #1
0
def test_adapt_to_mms_format(path_exists, make_dir, subprocess_check_call,
                             set_python_path):
    handler_service = Mock()

    model_server._adapt_to_mms_format(handler_service)

    path_exists.assert_called_once_with(
        model_server.DEFAULT_MMS_MODEL_DIRECTORY)
    make_dir.assert_called_once_with(model_server.DEFAULT_MMS_MODEL_DIRECTORY)

    model_archiver_cmd = [
        "model-archiver",
        "--model-name",
        model_server.DEFAULT_MMS_MODEL_NAME,
        "--handler",
        handler_service,
        "--model-path",
        environment.model_dir,
        "--export-path",
        model_server.DEFAULT_MMS_MODEL_DIRECTORY,
        "--archive-format",
        "no-archive",
    ]

    subprocess_check_call.assert_called_once_with(model_archiver_cmd)
    set_python_path.assert_called_once_with()
def test_adapt_to_mms_format_existing_path(path_exists, make_dir, subprocess_check_call, set_python_path):
    handler_service = Mock()

    model_server._adapt_to_mms_format(handler_service)

    path_exists.assert_called_once_with(model_server.DEFAULT_MMS_MODEL_DIRECTORY)
    make_dir.assert_not_called()