summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/tests/emerge/test_simple.py14
-rw-r--r--pym/portage/tests/repoman/test_simple.py27
2 files changed, 26 insertions, 15 deletions
diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index a13d0e6cb..2aca3e308 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -74,9 +74,8 @@ class SimpleEmergeTestCase(TestCase):
portage_tmpdir = os.path.join(eprefix, "var", "tmp", "portage")
profile_path = settings.profile_path
var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
- env = os.environ.copy()
- path = env.get("PATH")
+ path = os.environ.get("PATH")
if path is not None and not path.strip():
path = None
if path is None:
@@ -85,7 +84,7 @@ class SimpleEmergeTestCase(TestCase):
path = ":" + path
path = fake_bin + path
- pythonpath = env.get("PYTHONPATH")
+ pythonpath = os.environ.get("PYTHONPATH")
if pythonpath is not None and not pythonpath.strip():
pythonpath = None
if pythonpath is not None and \
@@ -98,15 +97,18 @@ class SimpleEmergeTestCase(TestCase):
pythonpath = ":" + pythonpath
pythonpath = PORTAGE_PYM_PATH + pythonpath
- env['PYTHONPATH'] = pythonpath
- env.update({
+ env = {
"__PORTAGE_TEST_EPREFIX" : eprefix,
"DISTDIR" : distdir,
"INFODIR" : "",
"INFOPATH" : "",
"PATH" : path,
+ "PORTAGE_GRPNAME" : os.environ["PORTAGE_GRPNAME"],
"PORTAGE_TMPDIR" : portage_tmpdir,
- })
+ "PORTAGE_USERNAME" : os.environ["PORTAGE_USERNAME"],
+ "PYTHONPATH" : pythonpath,
+ }
+
dirs = [distdir, fake_bin, portage_tmpdir, var_cache_edb]
true_symlinks = ["chown", "chgrp"]
true_binary = find_binary("true")
diff --git a/pym/portage/tests/repoman/test_simple.py b/pym/portage/tests/repoman/test_simple.py
index b15678918..ba5014777 100644
--- a/pym/portage/tests/repoman/test_simple.py
+++ b/pym/portage/tests/repoman/test_simple.py
@@ -112,21 +112,30 @@ class SimpleRepomanTestCase(TestCase):
portdir = settings["PORTDIR"]
profiles_dir = os.path.join(portdir, "profiles")
license_dir = os.path.join(portdir, "licenses")
- env = os.environ.copy()
- pythonpath = env.get("PYTHONPATH")
+
+ pythonpath = os.environ.get("PYTHONPATH")
if pythonpath is not None and not pythonpath.strip():
pythonpath = None
- if pythonpath is None:
- pythonpath = ""
+ if pythonpath is not None and \
+ pythonpath.startswith(PORTAGE_PYM_PATH + ":"):
+ pass
else:
- pythonpath = ":" + pythonpath
- pythonpath = PORTAGE_PYM_PATH + pythonpath
- env['PYTHONPATH'] = pythonpath
- env.update({
+ if pythonpath is None:
+ pythonpath = ""
+ else:
+ pythonpath = ":" + pythonpath
+ pythonpath = PORTAGE_PYM_PATH + pythonpath
+
+ env = {
"__REPOMAN_TEST_EPREFIX" : eprefix,
"DISTDIR" : distdir,
+ "PATH" : os.environ["PATH"],
+ "PORTAGE_GRPNAME" : os.environ["PORTAGE_GRPNAME"],
+ "PORTAGE_USERNAME" : os.environ["PORTAGE_USERNAME"],
"PORTDIR" : portdir,
- })
+ "PYTHONPATH" : pythonpath,
+ }
+
dirs = [license_dir, profiles_dir, distdir]
try:
for d in dirs: