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')
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())
def test_nonexistent(self): p = EnvConfParser('i_dont_exist', FIXTURES, {}) p.parse()
def test_include(self): p = EnvConfParser('include', FIXTURES, {}) r = p.parse() self.assertEqual(r, {'FOO': 'bar', 'BAR': 'baz'})
def test_unset(self): p = EnvConfParser('unset', FIXTURES, {'FOO': 'bar', 'BAR': 'baz'}) r = p.parse() self.assertEqual(r, {'FOO': 'bar'})
def test_clear_order(self): p = EnvConfParser('clear_order', FIXTURES, {}) r = p.parse() self.assertEqual(r, {'BAR': 'baz'})
def test_clear_alone(self): p = EnvConfParser('clear_alone', FIXTURES, {'FOO': 'bar'}) r = p.parse() self.assertEqual(r, {})
def test_simple(self): p = EnvConfParser('simple', FIXTURES, {}) r = p.parse() self.assertEqual(r, {'FOO': 'bar', 'BAR': 'baz', 'BAZ': 'bat'})