示例#1
0
    def set_locals(self, dir, appname, reload=True):
#        os.chdir(dir)
        import shell
        import types
        
        locals = shell.env(appname, dir=dir)
        if reload:
            for k, v in locals.items():
                if isinstance(v, types.ModuleType):
                    reload(v)
        self.interp.locals = locals
示例#2
0
    def set_locals(self, dir, appname, reload=True):
        #        os.chdir(dir)
        import shell
        import types

        locals = shell.env(appname, dir=dir)
        if reload:
            for k, v in locals.items():
                if isinstance(v, types.ModuleType):
                    reload(v)
        self.interp.locals = locals
示例#3
0
 def test_expand_environment_var(self):
     self.assertNotEqual(shell.env('foo'), 'barbar')
     os.environ['foo'] = 'barbar'
     self.assertEqual(shell.ex('echo $foo').stdout(), b'barbar\n')
示例#4
0
 def test_get_environment_var(self):
     self.assertNotEqual(shell.env('foo'), 'bar')
     os.environ['foo'] = 'bar'
     self.assertEqual(shell.env('foo'), 'bar')
示例#5
0
 def test_expand_environment_var(self):
     self.assertNotEqual(shell.env('foo'), 'barbar')
     os.environ['foo'] = 'barbar'
     self.assertEqual(shell.ex('echo $foo').stdout(), b'barbar\n')
示例#6
0
 def test_get_environment_var(self):
     self.assertNotEqual(shell.env('foo'), 'bar')
     os.environ['foo'] = 'bar'
     self.assertEqual(shell.env('foo'), 'bar')