Beispiel #1
0
def test_install_no_python_executable(check_error, prepare, has_requirements,
                                      entry_point_type_module):
    with pytest.raises(RuntimeError) as e:
        entry_point.install("train.py", "git://aws/container-support")
    assert str(
        e.value
    ) == "Failed to retrieve the real path for the Python executable binary"
Beispiel #2
0
def test_install_script(check_error, prepare, entry_point_type_module,
                        has_requirements):
    path = "c://sagemaker-pytorch-container"
    entry_point.install("train.py", path)

    with patch("os.path.exists", return_value=True):
        entry_point.install(path, "python_module.py")
def test_install_module(check_error, prepare, entry_point_type_module):
    path = "c://sagemaker-pytorch-container"
    entry_point.install("python_module.py", path)

    cmd = [sys.executable, "-m", "pip", "install", "."]
    check_error.assert_called_with(cmd, errors.InstallModuleError, capture_error=False, cwd=path)

    with patch("os.path.exists", return_value=True):
        entry_point.install("python_module.py", path)

        check_error.assert_called_with(
            cmd + ["-r", "requirements.txt"],
            errors.InstallModuleError,
            cwd=path,
            capture_error=False,
        )
Beispiel #4
0
def test_install_fails(check_error, prepare, entry_point_type_module):
    check_error.side_effect = errors.ClientError()
    with pytest.raises(errors.ClientError):
        entry_point.install("git://aws/container-support", "script")