changeset 957:b7264225c62f

Make application tests run even with no PYTHONPATH.
author Martin Geisler <mg@daimi.au.dk>
date Thu, 02 Oct 2008 20:45:34 +0200
parents 35fc8a249a2a
children 0c69f21714b7
files viff/test/test_apps.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/viff/test/test_apps.py	Sun Sep 28 10:49:01 2008 +0200
+++ b/viff/test/test_apps.py	Thu Oct 02 20:45:34 2008 +0200
@@ -44,8 +44,11 @@
     def setUp(self):
         """Switch to apps/ directory and generate config files."""
         root_dir = path.abspath(path.join(path.dirname(__file__), "..", ".."))
-        if root_dir not in os.environ["PYTHONPATH"]:
-            os.environ["PYTHONPATH"] += os.pathsep + root_dir
+        if root_dir not in os.environ.get("PYTHONPATH", ""):
+            if "PYTHONPATH" in os.environ:
+                os.environ["PYTHONPATH"] += os.pathsep + root_dir
+            else:
+                os.environ["PYTHONPATH"] = root_dir
 
         self.oldcwd = os.getcwd()
         os.chdir(path.join(root_dir, "apps"))