def testInstall(self): orig_path = sys.path orig_pythonpath = os.environ.get('PYTHONPATH') path = env.PythonPath.FromPaths('a', 'b') try: path.Install() self.assertEqual(sys.path, [os.path.abspath(p) for p in ('a', 'b')]) self.assertEqual( os.environ.get('PYTHONPATH'), '%s:%s' % (os.path.abspath('a'), os.path.abspath('b'))) finally: sys.path = orig_path env.SetPythonPathEnv(orig_pythonpath)
def testEmptyPythonPath(self): env.SetPythonPathEnv(None) self.assertEqual(len(env.GetEnvPythonPath()), 0)
def tearDown(self): super(GetEnvPythonPathTestCase, self).tearDown() env.SetPythonPathEnv(self._orig_pythonpath)
def setUp(self): self._orig_python_path = os.environ.get('PYTHONPATH') env.SetPythonPathEnv(None) super(NoEnvPythonPathTestCase, self).setUp()