Exemple #1
0
 def test_interpolate(self):
     p = EnvConfParser('interpolate', FIXTURES, {})
     r = p.parse()
     self.assertEqual(r['BLANK'], '')
     self.assertEqual(r['BAR_SLASH_BAR'], 'bar/bar')
     self.assertEqual(r['BAR_BAR'], 'bar_bar')
     self.assertEqual(r['NOT_INTERP'], '$FOO')
     self.assertEqual(r['INTERP'], 'bar')
Exemple #2
0
def envmgr():
    args = parser.parse_args()

    if not args.command:
        parser.print_help()
        sys.exit(1)

    if args.name is None:
        args.name = os.path.basename(args.command[0])

    env = EnvConfParser(args.name, args.root)

    os.execvpe(args.command[0], args.command, env.parse())
Exemple #3
0
 def test_nonexistent(self):
     p = EnvConfParser('i_dont_exist', FIXTURES, {})
     p.parse()
Exemple #4
0
 def test_include(self):
     p = EnvConfParser('include', FIXTURES, {})
     r = p.parse()
     self.assertEqual(r, {'FOO': 'bar', 'BAR': 'baz'})
Exemple #5
0
 def test_unset(self):
     p = EnvConfParser('unset', FIXTURES, {'FOO': 'bar', 'BAR': 'baz'})
     r = p.parse()
     self.assertEqual(r, {'FOO': 'bar'})
Exemple #6
0
 def test_clear_order(self):
     p = EnvConfParser('clear_order', FIXTURES, {})
     r = p.parse()
     self.assertEqual(r, {'BAR': 'baz'})
Exemple #7
0
 def test_clear_alone(self):
     p = EnvConfParser('clear_alone', FIXTURES, {'FOO': 'bar'})
     r = p.parse()
     self.assertEqual(r, {})
Exemple #8
0
 def test_simple(self):
     p = EnvConfParser('simple', FIXTURES, {})
     r = p.parse()
     self.assertEqual(r, {'FOO': 'bar', 'BAR': 'baz', 'BAZ': 'bat'})