1313 'Sarus' , 'Sarus+nocommand' , 'Sarus+nopull' , 'Sarus+mpi' , 'Sarus+load' ,
1414 'Shifter' , 'Shifter+nocommand' , 'Shifter+mpi' , 'Shifter+nopull' ,
1515 'Shifter+load' ,
16- 'Singularity' , 'Singularity+nocommand' , 'Singularity+cuda'
16+ 'Singularity' , 'Singularity+nocommand' , 'Singularity+cuda' ,
17+ 'Apptainer' , 'Apptainer+nocommand' , 'Apptainer+cuda'
1718])
1819def container_variant (request ):
1920 return request .param
@@ -101,7 +102,7 @@ def expected_cmd_mount_points(container_variant):
101102 '--mount=type=bind,source="/path/two",destination="/two" '
102103 '--mount=type=bind,source="/foo",destination="/rfm_workdir" '
103104 'load/library/image:tag cmd' )
104- elif container_variant in { 'Singularity' , 'Singularity+nopull' } :
105+ elif container_variant == 'Singularity' :
105106 return ('singularity exec -B"/path/one:/one" '
106107 '-B"/path/two:/two" -B"/foo:/rfm_workdir" '
107108 '--pwd /rfm_workdir image:tag cmd' )
@@ -113,6 +114,19 @@ def expected_cmd_mount_points(container_variant):
113114 return ('singularity run -B"/path/one:/one" '
114115 '-B"/path/two:/two" -B"/foo:/rfm_workdir" '
115116 '--pwd /rfm_workdir image:tag' )
117+ elif container_variant == 'Apptainer' :
118+ return ('apptainer exec -B"/path/one:/one" '
119+ '-B"/path/two:/two" -B"/foo:/rfm_workdir" '
120+ '--pwd /rfm_workdir image:tag cmd' )
121+ elif container_variant == 'Apptainer+cuda' :
122+ return ('apptainer exec -B"/path/one:/one" '
123+ '-B"/path/two:/two" -B"/foo:/rfm_workdir" --nv '
124+ '--pwd /rfm_workdir image:tag cmd' )
125+ elif container_variant == 'Apptainer+nocommand' :
126+ return ('apptainer run -B"/path/one:/one" '
127+ '-B"/path/two:/two" -B"/foo:/rfm_workdir" '
128+ '--pwd /rfm_workdir image:tag' )
129+
116130
117131
118132@pytest .fixture
@@ -180,7 +194,7 @@ def expected_cmd_run_opts(container_variant):
180194 '--mount=type=bind,source="/path/one",destination="/one" '
181195 '--mount=type=bind,source="/foo",destination="/rfm_workdir" '
182196 '--mpi --foo --bar image:tag cmd' )
183- elif container_variant in { 'Singularity' } :
197+ elif container_variant == 'Singularity' :
184198 return ('singularity exec -B"/path/one:/one" -B"/foo:/rfm_workdir" '
185199 '--foo --bar image:tag cmd' )
186200 elif container_variant == 'Singularity+cuda' :
@@ -189,6 +203,15 @@ def expected_cmd_run_opts(container_variant):
189203 elif container_variant == 'Singularity+nocommand' :
190204 return ('singularity run -B"/path/one:/one" -B"/foo:/rfm_workdir" '
191205 '--foo --bar image:tag' )
206+ elif container_variant == 'Apptainer' :
207+ return ('apptainer exec -B"/path/one:/one" -B"/foo:/rfm_workdir" '
208+ '--foo --bar image:tag cmd' )
209+ elif container_variant == 'Apptainer+cuda' :
210+ return ('apptainer exec -B"/path/one:/one" -B"/foo:/rfm_workdir" '
211+ '--nv --foo --bar image:tag cmd' )
212+ elif container_variant == 'Apptainer+nocommand' :
213+ return ('apptainer run -B"/path/one:/one" -B"/foo:/rfm_workdir" '
214+ '--foo --bar image:tag' )
192215
193216
194217def test_mount_points (container_platform , expected_cmd_mount_points ):
@@ -245,6 +268,9 @@ def expected_run_with_commands(container_variant_noopt):
245268 elif container_variant_noopt == 'Singularity' :
246269 return ("singularity exec -B\" /foo:/rfm_workdir\" "
247270 "--foo image:tag bash -c 'cmd1; cmd2'" )
271+ elif container_variant_noopt == 'Apptainer' :
272+ return ("apptainer exec -B\" /foo:/rfm_workdir\" "
273+ "--foo image:tag bash -c 'cmd1; cmd2'" )
248274
249275
250276@pytest .fixture
@@ -267,6 +293,9 @@ def expected_run_with_workdir(container_variant_noopt):
267293 elif container_variant_noopt == 'Singularity' :
268294 return ('singularity exec -B\" /foo:/rfm_workdir\" --pwd foodir '
269295 '--foo image:tag cmd1' )
296+ elif container_variant_noopt == 'Apptainer' :
297+ return ('apptainer exec -B\" /foo:/rfm_workdir\" --pwd foodir '
298+ '--foo image:tag cmd1' )
270299
271300
272301def test_run_with_workdir (container_platform_with_opts ,
0 commit comments