diff options
author | André Apitzsch <git@apitzsch.eu> | 2018-11-11 03:31:50 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2018-11-11 18:50:59 +0300 |
commit | 989926a680e7802e1b632846caa8e536bc813a29 (patch) | |
tree | d4907cd2057b2ee639626d3f7c3aaef19602815c /test/lib | |
parent | 522eec007dc1a2680b2fc3919f37028244ba57df (diff) |
Restructure test
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/__init__.py | 29 | ||||
-rw-r--r-- | test/lib/gajim_mocks.py | 2 |
2 files changed, 9 insertions, 22 deletions
diff --git a/test/lib/__init__.py b/test/lib/__init__.py index ba1367a1b..d3816c14d 100644 --- a/test/lib/__init__.py +++ b/test/lib/__init__.py @@ -1,26 +1,15 @@ -import sys import os -import getopt -use_x = True -shortargs = 'hnv:' -longargs = 'help no-x verbose=' -opts, args = getopt.getopt(sys.argv[1:], shortargs, longargs.split()) -for o, a in opts: - if o in ('-n', '--no-x'): - use_x = False - -gajim_root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../..') - -# look for modules in the CWD, then gajim/test/lib, then gajim/gajim, -# then everywhere else -sys.path.insert(1, gajim_root) -sys.path.insert(1, gajim_root + '/test/lib') +from tempfile import gettempdir # a temporary version of ~/.gajim for testing -configdir = gajim_root + '/test/tmp' +configdir = os.path.join(gettempdir(), 'gajim') +os.makedirs(configdir, exist_ok=True) + # plugins config dir pluginsconfigdir = configdir + '/pluginsconfig' +# theme config directory +themedir = configdir + '/theme' # define _ for i18n import builtins @@ -28,7 +17,7 @@ builtins._ = lambda x: x from gajim.common.contacts import LegacyContactsAPI -def setup_env(): +def setup_env(use_x=True): # wipe config directory if os.path.isdir(configdir): import shutil @@ -36,6 +25,7 @@ def setup_env(): os.mkdir(configdir) os.mkdir(pluginsconfigdir) + os.mkdir(themedir) from gajim.common import configpaths configpaths.set_config_root(configdir) @@ -47,13 +37,10 @@ def setup_env(): import logging logging.basicConfig() - configpaths.override_path('DATA', gajim_root + '/gajim/data') app.use_x = use_x app.contacts = LegacyContactsAPI() app.connections = {} if use_x: - from gajim import gtkgui_helpers - gtkgui_helpers.GUI_DIR = gajim_root + '/gajim/data/gui' from gajim.application import GajimApplication app.app = GajimApplication() diff --git a/test/lib/gajim_mocks.py b/test/lib/gajim_mocks.py index 5f03d835b..b5ffa9562 100644 --- a/test/lib/gajim_mocks.py +++ b/test/lib/gajim_mocks.py @@ -2,7 +2,7 @@ Module with dummy classes for Gajim specific unit testing ''' -from mock import Mock +from .mock import Mock from gajim.common import app from gajim.common import ged |