Пример #1
0
 def test_interpolate_default(self):
     config = Configuration()
     self.assertEqual('python2.3',
                      config.interpolate('${python.path:python2.3}'))
     self.assertEqual(
         'foo python2.3 bar',
         config.interpolate('foo ${python.path:python2.3} bar'))
Пример #2
0
 def test_interpolate(self):
     config = Configuration(properties={
         'python.version': '2.3.5',
         'python.path': '/usr/local/bin/python2.3'
     })
     self.assertEqual('/usr/local/bin/python2.3',
                      config.interpolate('${python.path}'))
     self.assertEqual('foo /usr/local/bin/python2.3 bar',
                      config.interpolate('foo ${python.path} bar'))
Пример #3
0
 def test_interpolate(self):
     config = Configuration(properties={
         'python.version': '2.3.5',
         'python.path': '/usr/local/bin/python2.3'
     })
     self.assertEqual('/usr/local/bin/python2.3',
                      config.interpolate('${python.path}'))
     self.assertEqual('foo /usr/local/bin/python2.3 bar',
                      config.interpolate('foo ${python.path} bar'))
Пример #4
0
 def test_interpolate_environment(self):
     config = Configuration()
     os.environ['BITTEN_TEST'] = 'foo'
     try:
         # regular substitutions
         self.assertEquals(os.environ['BITTEN_TEST'],
                           config.interpolate('$BITTEN_TEST'))
         self.assertEquals(os.environ['BITTEN_TEST'],
                           config.interpolate('${BITTEN_TEST}'))
         if os.name == 'posix':
             # case-sensitive
             self.assertEquals('${bitten_test}',
                               config.interpolate('${bitten_test}'))
             self.assertEquals('$bitten_test',
                               config.interpolate('$bitten_test'))
         elif os.name == 'nt':
             # case-insensitive
             self.assertEquals(os.environ['bitten_test'],
                               config.interpolate('$bitten_test'))
             self.assertEquals(os.environ['bitten_test'],
                               config.interpolate('${bitten_test}'))
     finally:
         del os.environ['BITTEN_TEST']
Пример #5
0
 def test_interpolate_environment(self):
     config = Configuration()
     os.environ['BITTEN_TEST'] = 'foo'
     try:
         # regular substitutions
         self.assertEquals(os.environ['BITTEN_TEST'],
                     config.interpolate('$BITTEN_TEST'))
         self.assertEquals(os.environ['BITTEN_TEST'],
                     config.interpolate('${BITTEN_TEST}'))
         if os.name == 'posix':
             # case-sensitive
             self.assertEquals('${bitten_test}',
                         config.interpolate('${bitten_test}'))
             self.assertEquals('$bitten_test',
                         config.interpolate('$bitten_test'))
         elif os.name == 'nt':
             # case-insensitive
             self.assertEquals(os.environ['bitten_test'],
                         config.interpolate('$bitten_test'))
             self.assertEquals(os.environ['bitten_test'],
                         config.interpolate('${bitten_test}'))
     finally:
         del os.environ['BITTEN_TEST']
Пример #6
0
 def test_interpolate_missing(self):
     config = Configuration()
     self.assertEqual('${python.path}',
                      config.interpolate('${python.path}'))
     self.assertEqual('foo ${python.path} bar',
                      config.interpolate('foo ${python.path} bar'))
Пример #7
0
 def test_interpolate_missing(self):
     config = Configuration()
     self.assertEqual('${python.path}',
                      config.interpolate('${python.path}'))
     self.assertEqual('foo ${python.path} bar',
                      config.interpolate('foo ${python.path} bar'))
Пример #8
0
 def test_interpolate_default(self):
     config = Configuration()
     self.assertEqual('python2.3',
                      config.interpolate('${python.path:python2.3}'))
     self.assertEqual('foo python2.3 bar',
                      config.interpolate('foo ${python.path:python2.3} bar'))