def test_install_no_python_executable(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'
def test_install_script(check_error, 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_script(check_error, 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, entry_point_type_module): path = 'c://sagemaker-pytorch-container' entry_point.install('python_module.py', path) cmd = [sys.executable, '-m', 'pip', 'install', '-U', '.'] 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)
def test_install_module(check_error, 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, )
def test_install_fails(check_error, entry_point_type_module): check_error.side_effect = _errors.ClientError() with pytest.raises(_errors.ClientError): entry_point.install('git://aws/container-support', 'script')