summaryrefslogtreecommitdiffstats
path: root/tests/helper/Stubs.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/helper/Stubs.py')
-rw-r--r--tests/helper/Stubs.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/helper/Stubs.py b/tests/helper/Stubs.py
index 3541e4ffb..4bb8ade9e 100644
--- a/tests/helper/Stubs.py
+++ b/tests/helper/Stubs.py
@@ -1,20 +1,22 @@
# -*- coding: utf-8 -*-
+import sys
from os.path import join
from time import strftime
from traceback import format_exc
import __builtin__
+from pyload.InitHomeDir import init_dir
+
+init_dir(join("tests", "config"), True)
+
from pyload.Api import Role
from pyload.Core import Core
-from pyload.InitHomeDir import init_dir
from pyload.datatypes.User import User
from pyload.threads.BaseThread import BaseThread
from pyload.config.ConfigParser import ConfigParser
-init_dir(join("tests", "config"))
-
from logging import log, DEBUG, INFO, WARN, ERROR
# Do nothing
@@ -94,3 +96,9 @@ adminUser = User(None, uid=0, role=Role.Admin)
normalUser = User(None, uid=1, role=Role.User)
otherUser = User(None, uid=2, role=Role.User)
+# fixes the module paths because we changed the directory
+for name, m in sys.modules.iteritems():
+ if not name.startswith("tests") or not m or not hasattr(m, "__path__"):
+ continue
+
+ m.__path__[0] = join("..", "..", m.__path__[0]) \ No newline at end of file