From 1f91d0fd06180833ebe2adb28be4849bb8be4a12 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Wed, 18 Jan 2012 22:39:25 +0100 Subject: [PATCH] Adapt imports so that test/OLItest can be imported To run the test suite from the main setup.py we need to be able to import and run the test suite from a different folder than the "test" dir. Make "test" a package and fix the imports to still work when imported from another folder. Signed-off-by: Sebastian Spaeth --- test/OLItest/TestRunner.py | 2 +- test/__init__.py | 0 test/tests/test_01_basic.py | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 test/__init__.py diff --git a/test/OLItest/TestRunner.py b/test/OLItest/TestRunner.py index 5235949..bb7e1c6 100644 --- a/test/OLItest/TestRunner.py +++ b/test/OLItest/TestRunner.py @@ -21,7 +21,7 @@ import shutil import subprocess import tempfile from ConfigParser import SafeConfigParser -from OLItest import default_conf +from . import default_conf class OLITestLib(): cred_file = None diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/tests/test_01_basic.py b/test/tests/test_01_basic.py index 4456890..7f30052 100644 --- a/test/tests/test_01_basic.py +++ b/test/tests/test_01_basic.py @@ -17,8 +17,8 @@ import random import unittest import logging import os, sys -# Insert ".." into the python search path -cmd_folder = os.path.dirname(os.path.abspath(__file__)) +# Insert ".." into the python search path to get OLItest +cmd_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) if cmd_folder not in sys.path: sys.path.insert(0, cmd_folder) from OLItest import OLITestLib