Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2008-08-27 11:55:06 +0400
committerYann Leboulanger <asterix@lagaule.org>2008-08-27 11:55:06 +0400
commit8a83033816ee14df113762935bbfadb876b51a54 (patch)
tree21e8941e9b7a48de6b055aa8d5ae274349abfc72 /test/lib
parent1e8e0f6067a690986863e5b4e781c45683b2212a (diff)
add some options to runtests.py to be able to tune verbosity and wether we want to run tests that require X or not
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/__init__.py13
-rw-r--r--test/lib/mocks.py14
2 files changed, 23 insertions, 4 deletions
diff --git a/test/lib/__init__.py b/test/lib/__init__.py
index 3a1300e12..e439acf26 100644
--- a/test/lib/__init__.py
+++ b/test/lib/__init__.py
@@ -1,5 +1,12 @@
import sys
import os.path
+import getopt
+
+use_x = True
+opts, args = getopt.getopt(sys.argv[1:], 'n', ['no-x'])
+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__)), '../..')
@@ -32,8 +39,10 @@ def setup_env():
from common import gajim
gajim.DATA_DIR = gajim_root + '/data'
+ gajim.use_x = use_x
- import gtkgui_helpers
- gtkgui_helpers.GLADE_DIR = gajim_root + '/data/glade'
+ if use_x:
+ import gtkgui_helpers
+ gtkgui_helpers.GLADE_DIR = gajim_root + '/data/glade'
# vim: se ts=3:
diff --git a/test/lib/mocks.py b/test/lib/mocks.py
index f5c74f607..8d0e80f96 100644
--- a/test/lib/mocks.py
+++ b/test/lib/mocks.py
@@ -19,7 +19,8 @@ class MockConnection(Mock, ConnectionHandlersBase):
self.blocked_groups = {}
self.sessions = {}
- gajim.interface.instances[account] = {'infos': {}, 'disco': {}, 'gc_config': {}, 'search': {}}
+ gajim.interface.instances[account] = {'infos': {}, 'disco': {},
+ 'gc_config': {}, 'search': {}}
gajim.interface.minimized_controls[account] = {}
gajim.contacts.add_account(account)
gajim.groups[account] = {}
@@ -91,6 +92,7 @@ class MockChatControl(Mock):
class MockInterface(Mock):
def __init__(self, *args):
Mock.__init__(self, *args)
+ gajim.interface = self
self.msg_win_mgr = Mock()
self.roster = Mock()
@@ -99,7 +101,15 @@ class MockInterface(Mock):
self.minimized_controls = {}
self.status_sent_to_users = Mock()
- self.jabber_state_images = {'16': Mock(), '32': Mock(), 'opened': Mock(), 'closed': Mock()}
+ if gajim.use_x:
+ self.jabber_state_images = {'16': {}, '32': {}, 'opened': {},
+ 'closed': {}}
+
+ import gtkgui_helpers
+ gtkgui_helpers.make_jabber_state_images()
+ else:
+ self.jabber_state_images = {'16': Mock(), '32': Mock(),
+ 'opened': Mock(), 'closed': Mock()}
class MockLogger(Mock):
def __init__(self):