Beispiel #1
0
 def test_process_variables_missing_rvalue(self):
     with self.assertRaises(ValueError):
         options = PortableOptions([
             '--environment_type=PROCESS',
             '--environment_option=process_command=foo',
             '--environment_option=process_variables='
             'BASH_VARIABLE_ONE=spam,MISSING_RVALUE',
             '--sdk_location=container'
         ])
         ProcessEnvironment.from_options(options)
 def test_environments_with_same_hints_are_equal(self):
     options = PortableOptions([
         '--environment_type=PROCESS',
         '--environment_option=process_command=foo',
         '--sdk_location=container',
         '--resource_hint=accelerator=gpu',
     ])
     environment1 = ProcessEnvironment.from_options(options)
     environment2 = ProcessEnvironment.from_options(options)
     self.assertEqual(environment1, environment2)
Beispiel #3
0
 def test_process_variables_empty(self):
     options = PortableOptions([
         '--environment_type=PROCESS',
         '--environment_option=process_command=foo',
         '--sdk_location=container'
     ])
     environment = ProcessEnvironment.from_options(options)
     self.assertEqual(environment.command, 'foo')
     self.assertEqual(environment.env, {})
Beispiel #4
0
 def test_process_variables_set(self):
     options = PortableOptions([
         '--environment_type=PROCESS',
         '--environment_option=process_command=foo',
         '--environment_option=process_variables='
         'BASH_VARIABLE_ONE=spam,BASH_VARIABLE_TWO=ham',
         '--sdk_location=container'
     ])
     environment = ProcessEnvironment.from_options(options)
     self.assertEqual(environment.command, 'foo')
     self.assertEqual(environment.env, {
         'BASH_VARIABLE_ONE': 'spam',
         'BASH_VARIABLE_TWO': 'ham'
     })