summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-08 11:20:09 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-08 11:20:09 -0700
commita84eeb759243ba81abf874126ded9c8517edb20d (patch)
treed64f49d42705524d77a2f3a27f580aeab968dd7a
parentca0f8a663dc4b41145acad80f17b1596a2ad07ee (diff)
downloadportage-a84eeb759243ba81abf874126ded9c8517edb20d.tar.gz
portage-a84eeb759243ba81abf874126ded9c8517edb20d.tar.bz2
portage-a84eeb759243ba81abf874126ded9c8517edb20d.zip
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.
-rw-r--r--pym/portage/tests/lazyimport/test_lazy_import_portage_baseline.py14
1 files changed, 13 insertions, 1 deletions
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()