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 <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-01-18 22:39:25 +01:00
parent 1cdabcec46
commit 1f91d0fd06
3 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ import shutil
import subprocess import subprocess
import tempfile import tempfile
from ConfigParser import SafeConfigParser from ConfigParser import SafeConfigParser
from OLItest import default_conf from . import default_conf
class OLITestLib(): class OLITestLib():
cred_file = None cred_file = None

0
test/__init__.py Normal file
View File

View File

@ -17,8 +17,8 @@ import random
import unittest import unittest
import logging import logging
import os, sys import os, sys
# Insert ".." into the python search path # Insert ".." into the python search path to get OLItest
cmd_folder = os.path.dirname(os.path.abspath(__file__)) cmd_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if cmd_folder not in sys.path: if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder) sys.path.insert(0, cmd_folder)
from OLItest import OLITestLib from OLItest import OLITestLib