viff

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 diff
     1.1 --- a/viff/test/test_apps.py	Sun Sep 28 10:49:01 2008 +0200
     1.2 +++ b/viff/test/test_apps.py	Thu Oct 02 20:45:34 2008 +0200
     1.3 @@ -44,8 +44,11 @@
     1.4      def setUp(self):
     1.5          """Switch to apps/ directory and generate config files."""
     1.6          root_dir = path.abspath(path.join(path.dirname(__file__), "..", ".."))
     1.7 -        if root_dir not in os.environ["PYTHONPATH"]:
     1.8 -            os.environ["PYTHONPATH"] += os.pathsep + root_dir
     1.9 +        if root_dir not in os.environ.get("PYTHONPATH", ""):
    1.10 +            if "PYTHONPATH" in os.environ:
    1.11 +                os.environ["PYTHONPATH"] += os.pathsep + root_dir
    1.12 +            else:
    1.13 +                os.environ["PYTHONPATH"] = root_dir
    1.14  
    1.15          self.oldcwd = os.getcwd()
    1.16          os.chdir(path.join(root_dir, "apps"))