@@ -194,73 +194,66 @@ def tearDown(self):
194194 """Clean up the temporary directory after each test."""
195195 shutil .rmtree (self .temp_dir )
196196
197- @integration_test ( scope = "component" )
198- @slow_test
199- def test_install_actual_package_success (self ):
200- """Test actual installation of a real Python package without mocking .
197+ @regression_test
198+ @mock . patch . object ( PythonInstaller , "_run_pip_subprocess" , return_value = 0 )
199+ def test_install_actual_package_success (self , mock_run ):
200+ """Test installation pipeline returns COMPLETED on successful pip install .
201201
202- Uses a lightweight package that's commonly available and installs quickly.
203- This validates the entire installation pipeline including subprocess handling.
202+ Mocks _run_pip_subprocess to validate our install flow without calling pip.
204203 """
205- # Use a lightweight, commonly available package for testing
206204 dep = {"name" : "wheel" , "version_constraint" : "*" , "type" : "python" }
207205
208- # Create a virtual environment context to avoid polluting system packages
209- context = DummyContext (
210- env_path = self .env_path ,
211- env_name = "test_env" ,
212- extra_config = {
213- "python_executable" : self .python_executable ,
214- "target_dir" : str (self .env_path ),
215- },
216- )
217- result = self .installer .install (dep , context )
206+ result = self .installer .install (dep , self .dummy_context )
218207 self .assertEqual (result .status , InstallationStatus .COMPLETED )
219208 self .assertIn ("wheel" , result .dependency_name )
209+ mock_run .assert_called_once ()
220210
221- @integration_test ( scope = "component" )
222- @slow_test
223- def test_install_package_with_version_constraint (self ):
211+ @regression_test
212+ @mock . patch . object ( PythonInstaller , "_run_pip_subprocess" , return_value = 0 )
213+ def test_install_package_with_version_constraint (self , mock_run ):
224214 """Test installation with specific version constraint.
225215
226- Validates that version constraints are properly passed to pip
227- and that the installation succeeds with real package resolution .
216+ Validates that version constraints are properly passed through
217+ our install flow and result metadata is populated .
228218 """
229- dep = {"name" : "setuptools" , "version_constraint" : ">=40.0.0" , "type" : "python" }
230-
231- context = DummyContext (
232- env_path = self .env_path ,
233- env_name = "test_env" ,
234- extra_config = {"python_executable" : self .python_executable },
235- )
219+ dep = {
220+ "name" : "setuptools" ,
221+ "version_constraint" : ">=40.0.0" ,
222+ "type" : "python" ,
223+ }
236224
237- result = self .installer .install (dep , context )
225+ result = self .installer .install (dep , self . dummy_context )
238226 self .assertEqual (result .status , InstallationStatus .COMPLETED )
239- # Verify the dependency was processed correctly
240227 self .assertIsNotNone (result .metadata )
228+ # Verify the version constraint was included in the command
229+ cmd_args = mock_run .call_args [0 ][0 ]
230+ self .assertTrue (
231+ any ("setuptools>=40.0.0" in arg for arg in cmd_args ),
232+ f"Expected 'setuptools>=40.0.0' in pip command args: { cmd_args } " ,
233+ )
241234
242- @integration_test ( scope = "component" )
243- @slow_test
244- def test_install_package_with_extras (self ):
235+ @regression_test
236+ @mock . patch . object ( PythonInstaller , "_run_pip_subprocess" , return_value = 0 )
237+ def test_install_package_with_extras (self , mock_run ):
245238 """Test installation of a package with extras specification.
246239
247- Tests the extras handling functionality with a real package installation .
240+ Validates that extras are correctly formatted in the pip command .
248241 """
249242 dep = {
250243 "name" : "requests" ,
251244 "version_constraint" : "*" ,
252245 "type" : "python" ,
253- "extras" : ["security" ], # pip[security] if available
246+ "extras" : ["security" ],
254247 }
255248
256- context = DummyContext (
257- env_path = self .env_path ,
258- env_name = "test_env" ,
259- extra_config = {"python_executable" : self .python_executable },
260- )
261-
262- result = self .installer .install (dep , context )
249+ result = self .installer .install (dep , self .dummy_context )
263250 self .assertEqual (result .status , InstallationStatus .COMPLETED )
251+ # Verify extras were included in the pip command
252+ cmd_args = mock_run .call_args [0 ][0 ]
253+ self .assertTrue (
254+ any ("requests[security]" in arg for arg in cmd_args ),
255+ f"Expected 'requests[security]' in pip command args: { cmd_args } " ,
256+ )
264257
265258 @integration_test (scope = "component" )
266259 @slow_test
0 commit comments