From: Zac Medico Date: Wed, 8 Sep 2010 18:20:09 +0000 (-0700) Subject: Fix LazyImportPortageBaselineTestCase to export PYTHONPATH to the X-Git-Tag: v2.2_rc78~12 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a84eeb759243ba81abf874126ded9c8517edb20d;p=portage.git Fix LazyImportPortageBaselineTestCase to export PYTHONPATH to the subprocess, to ensure that the correct version of portage is imported. This should fix failures on the buildbot. --- diff --git a/pym/portage/tests/lazyimport/test_lazy_import_portage_baseline.py b/pym/portage/tests/lazyimport/test_lazy_import_portage_baseline.py index 97b1495d4..4e480d93f 100644 --- a/pym/portage/tests/lazyimport/test_lazy_import_portage_baseline.py +++ b/pym/portage/tests/lazyimport/test_lazy_import_portage_baseline.py @@ -4,6 +4,7 @@ import re import portage from portage import os +from portage.const import PORTAGE_PYM_PATH from portage.tests import TestCase from _emerge.PollScheduler import PollScheduler @@ -30,13 +31,24 @@ class LazyImportPortageBaselineTestCase(TestCase): Check what modules are imported by a baseline module import. """ + env = os.environ.copy() + pythonpath = env.get('PYTHONPATH') + if pythonpath is not None and not pythonpath.strip(): + pythonpath = None + if pythonpath is None: + pythonpath = '' + else: + pythonpath = ':' + pythonpath + pythonpath = PORTAGE_PYM_PATH + pythonpath + env[pythonpath] = pythonpath + scheduler = PollScheduler().sched_iface master_fd, slave_fd = os.pipe() master_file = os.fdopen(master_fd, 'rb') slave_file = os.fdopen(slave_fd, 'wb') producer = SpawnProcess( args=self._baseline_import_cmd, - env=os.environ, fd_pipes={1:slave_fd}, + env=env, fd_pipes={1:slave_fd}, scheduler=scheduler) producer.start() slave_file.close()