Beispiel #1
0
 def test_cmd_with_working_directory_replacement(self):
     cmd = "ls {WORKING_DIR}"
     expected = cmd.format(WORKING_DIR=self.properties['working_directory'])
     with mock.patch.object(Singularity, 'CMD', cmd):
         s = Singularity(None, None)
         result = s.make_task_command()
     self.assertEqual(result, expected)
Beispiel #2
0
 def test_cmd_with_unfulfilled_args_option(self):
     cmd_kwargs = ["optiona", 'optionb']
     cmd = "command {ARGS}"
     expected = cmd.format(ARGS='')
     with mock.patch.object(Singularity, 'CMD', cmd), \
             mock.patch.object(Singularity, 'CMD_KWARGS', cmd_kwargs):
         s = Singularity(None, None)
         result = s.make_task_command()
     self.assertEqual(result, expected)
Beispiel #3
0
 def test_cmd_with_multiple_fulfilled_args_option(self):
     cmd_kwargs = ["optiona", 'optionb']
     self.params['optiona'] = 'valuea'
     self.params['optionb'] = 'valueb'
     cmd = "command {ARGS}"
     expected = cmd.format(ARGS='--optiona valuea --optionb valueb')
     with mock.patch.object(Singularity, 'CMD', cmd), \
             mock.patch.object(Singularity, 'CMD_KWARGS', cmd_kwargs):
         s = Singularity(None, None)
         result = s.make_task_command()
     self.assertEqual(result, expected)
Beispiel #4
0
 def test_cmd_with_no_replacements(self):
     cmd = "echo $PATH"
     with mock.patch.object(Singularity, 'CMD', cmd):
         s = Singularity(None, None)
         result = s.make_task_command()
     self.assertEqual(result, cmd)