summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2013-01-31 11:56:13 -0800
committerZac Medico <zmedico@gentoo.org>2013-01-31 11:56:13 -0800
commit88e8f1fcc212c93b5dc35dd441f1431986de07b7 (patch)
treeb8641f7e6a66edd3c59338c74d8d4f5e79d2d923
parentFix some typos. (diff)
downloadportage-88e8f1fcc212c93b5dc35dd441f1431986de07b7.tar.gz
portage-88e8f1fcc212c93b5dc35dd441f1431986de07b7.tar.bz2
portage-88e8f1fcc212c93b5dc35dd441f1431986de07b7.zip
runTests: handle samefile OSError, bug #454880
-rwxr-xr-xpym/portage/tests/runTests14
1 files changed, 10 insertions, 4 deletions
diff --git a/pym/portage/tests/runTests b/pym/portage/tests/runTests
index 53e1b5cc4..b0069698b 100755
--- a/pym/portage/tests/runTests
+++ b/pym/portage/tests/runTests
@@ -1,6 +1,6 @@
#!/usr/bin/python -Wd
# runTests.py -- Portage Unit Test Functionality
-# Copyright 2006-2012 Gentoo Foundation
+# Copyright 2006-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import os, sys
@@ -45,11 +45,17 @@ import portage.tests as tests
from portage.const import PORTAGE_BIN_PATH
path = os.environ.get("PATH", "").split(":")
path = [x for x in path if x]
-if not path or not os.path.samefile(path[0], PORTAGE_BIN_PATH):
+
+insert_bin_path = True
+try:
+ insert_bin_path = not path or \
+ not os.path.samefile(path[0], PORTAGE_BIN_PATH)
+except OSError:
+ pass
+
+if insert_bin_path:
path.insert(0, PORTAGE_BIN_PATH)
os.environ["PATH"] = ":".join(path)
-del path
-
if __name__ == "__main__":
sys.exit(tests.main())