@@ -179,6 +179,36 @@ describe("pypi manager", function()
179179 end
180180 )
181181
182+ it (" should prioritize stock python" , function ()
183+ local ctx = create_dummy_context { force = true }
184+ spy .on (ctx .stdio_sink , " stderr" )
185+ stub (ctx , " promote_cwd" )
186+ stub (ctx .fs , " file_exists" )
187+ stub (providers .pypi , " get_supported_python_versions" , mockx .returns (Result .success " >=3.8" ))
188+ stub (vim .fn , " executable" )
189+ vim .fn .executable .on_call_with (" python3.12" ).returns (1 )
190+ stub (spawn , " python3" , mockx .returns (Result .success ()))
191+ spawn .python3 .on_call_with ({ " --version" }).returns (Result .success { stdout = " Python 3.8.0" })
192+
193+ installer .exec_in_context (ctx , function ()
194+ pypi .init {
195+ package = { name = " cmake-language-server" , version = " 0.1.10" },
196+ upgrade_pip = true ,
197+ install_extra_args = { " --proxy" , " http://localhost" },
198+ }
199+ end )
200+
201+ assert .spy (ctx .promote_cwd ).was_called (1 )
202+ assert .spy (ctx .spawn .python3 ).was_called (1 )
203+ assert .spy (ctx .spawn [" python3.12" ]).was_called (0 )
204+ assert .spy (ctx .spawn .python3 ).was_called_with {
205+ " -m" ,
206+ " venv" ,
207+ " --system-site-packages" ,
208+ " venv" ,
209+ }
210+ end )
211+
182212 it (" should install" , function ()
183213 local ctx = create_dummy_context ()
184214 stub (ctx .fs , " file_exists" )
0 commit comments