@@ -260,6 +260,15 @@ def test_description(
260260 else :
261261 assert_never (runtime_env )
262262
263+ try :
264+ run_command (["thiscommandshouldalwaysfail" , "please" ])
265+ except Exception :
266+ pass
267+ else :
268+ raise RuntimeError (
269+ "given run_command does not raise an exception for a failing command"
270+ )
271+
263272 td_kwargs : Dict [str , Any ] = (
264273 dict (ignore_cleanup_errors = True ) if sys .version_info >= (3 , 10 ) else {}
265274 )
@@ -387,8 +396,8 @@ def _test_in_env(
387396 raise RuntimeError ("Conda not available" ) from e
388397
389398 try :
390- run_command ([CONDA_CMD , "activate " , env_name ])
391- except Exception :
399+ run_command ([CONDA_CMD , "run " , "-n" , env_name , "python" , "--version" ])
400+ except Exception as e :
392401 working_dir .mkdir (parents = True , exist_ok = True )
393402 path = working_dir / "env.yaml"
394403 try :
@@ -405,7 +414,8 @@ def _test_in_env(
405414 ]
406415 + (["--quiet" ] if settings .CI else [])
407416 )
408- run_command ([CONDA_CMD , "activate" , env_name ])
417+ # double check that environment was created successfully
418+ run_command ([CONDA_CMD , "run" , "-n" , env_name , "python" , "--version" ])
409419 except Exception as e :
410420 summary = descr .validation_summary
411421 summary .add_detail (
0 commit comments