@@ -469,6 +469,40 @@ def test_write_load_script_without_login_env_skips_compute_detection(
469469 assert 'MACHE_DEPLOY_ACTIVE_ENV_KIND="compute"' in script_text
470470
471471
472+ def test_write_load_script_omits_optional_exports_when_values_are_empty (
473+ tmp_path : Path , monkeypatch : pytest .MonkeyPatch
474+ ):
475+ monkeypatch .chdir (tmp_path )
476+ pixi_exe = _make_pixi_executable (tmp_path )
477+
478+ script_path = deploy_run ._write_load_script (
479+ prefix = str (tmp_path / 'compute' ),
480+ login_env = None ,
481+ pixi_exe = pixi_exe ,
482+ branch_path = None ,
483+ load_script_pixi_exe = _path_load_script_pixi (),
484+ software = 'e3sm-unified' ,
485+ software_version = '1.0.0' ,
486+ runtime_version_cmd = None ,
487+ machine = None ,
488+ compute_pixi_mpi = 'nompi' ,
489+ toolchain_compiler = None ,
490+ toolchain_mpi = None ,
491+ spack_library_view = None ,
492+ spack_activation = '' ,
493+ )
494+
495+ script_text = Path (script_path ).read_text (encoding = 'utf-8' )
496+ assert 'MACHE_DEPLOY_RUNTIME_VERSION_CMD' not in script_text
497+ assert 'MACHE_DEPLOY_LOGIN_PIXI_TOML' not in script_text
498+ assert 'MACHE_DEPLOY_TOOLCHAIN_COMPILER' not in script_text
499+ assert 'MACHE_DEPLOY_SPACK_LIBRARY_VIEW' not in script_text
500+ assert 'E3SM_UNIFIED_MACHINE' not in script_text
501+ assert 'E3SM_UNIFIED_COMPILER' not in script_text
502+ assert 'E3SM_UNIFIED_MPI' not in script_text
503+ assert 'E3SM_UNIFIED_LOAD_SCRIPT' in script_text
504+
505+
472506def test_copy_mache_pixi_toml_writes_slim_bootstrap_manifest (tmp_path : Path ):
473507 source_repo = tmp_path / 'source'
474508 source_repo .mkdir ()
0 commit comments