@@ -27,31 +27,34 @@ class TestRequirementsManager(unittest.TestCase):
27
27
"sagemaker.serve.builder.requirements_manager.RequirementsManager._install_requirements_txt"
28
28
)
29
29
@patch (
30
- "sagemaker.serve.builder.requirements_manager.RequirementsManager._capture_from_local_runtime "
30
+ "sagemaker.serve.builder.requirements_manager.RequirementsManager._detect_conda_env_and_local_dependencies "
31
31
)
32
- def test_detect_file_exists (
32
+ def test_capture_and_install_dependencies (
33
33
self ,
34
- mock_capture_from_local_runtime ,
34
+ mock_detect_conda_env_and_local_dependencies ,
35
35
mock_install_requirements_txt ,
36
36
mock_update_conda_env_in_path ,
37
37
) -> str :
38
38
39
- mock_capture_from_local_runtime .side_effect = lambda : ".txt"
40
- RequirementsManager ().detect_file_exists ()
39
+ mock_detect_conda_env_and_local_dependencies .side_effect = lambda : ".txt"
40
+ RequirementsManager ().capture_and_install_dependencies ()
41
41
mock_install_requirements_txt .assert_called_once ()
42
42
43
- mock_capture_from_local_runtime .side_effect = lambda : ".yml"
44
- RequirementsManager ().detect_file_exists ()
43
+ mock_detect_conda_env_and_local_dependencies .side_effect = lambda : ".yml"
44
+ RequirementsManager ().capture_and_install_dependencies ()
45
45
mock_update_conda_env_in_path .assert_called_once ()
46
46
47
47
@patch (
48
- "sagemaker.serve.builder.requirements_manager.RequirementsManager._capture_from_local_runtime "
48
+ "sagemaker.serve.builder.requirements_manager.RequirementsManager._detect_conda_env_and_local_dependencies "
49
49
)
50
- def test_detect_file_exists_fail (self , mock__capture_from_local_runtime ) -> str :
50
+ def test_capture_and_install_dependencies_fail (
51
+ self , mock_detect_conda_env_and_local_dependencies
52
+ ) -> str :
51
53
mock_dependencies = "mock.ini"
52
- mock__capture_from_local_runtime .side_effect = lambda : "invalid requirement"
54
+ mock_detect_conda_env_and_local_dependencies .side_effect = lambda : "invalid requirement"
53
55
self .assertRaises (
54
- ValueError , lambda : RequirementsManager ().detect_file_exists (mock_dependencies )
56
+ ValueError ,
57
+ lambda : RequirementsManager ().capture_and_install_dependencies (mock_dependencies ),
55
58
)
56
59
57
60
@patch ("sagemaker.serve.builder.requirements_manager.logger" )
@@ -63,7 +66,7 @@ def test_install_requirements_txt(self, mock_subprocess, mock_logger):
63
66
calls = [call ("Running command to pip install" ), call ("Command ran successfully" )]
64
67
mock_logger .info .assert_has_calls (calls )
65
68
mock_subprocess .run .assert_called_once_with (
66
- "pip install -r requirements .txt" , shell = True , check = True
69
+ "pip install -r in_process_requirements .txt" , shell = True , check = True
67
70
)
68
71
69
72
@patch ("sagemaker.serve.builder.requirements_manager.logger" )
0 commit comments