GlibMainLoopTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 5
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 3 1
1
import unittest
2
from unittest.case import SkipTest
3
4
try:
5
    from coalib import coala_dbus
6
    from gi.repository import GLib
7
except ImportError:
8
    raise SkipTest("python-gi or python-dbus not installed")
9
10
11
class GlibMainLoopTest:
12
13
    @staticmethod
14
    def run():
15
        raise AssertionError
16
17
18
class coalaDbusTest(unittest.TestCase):
19
20
    def setUp(self):
21
        self.glib_main_loop = GLib.MainLoop
22
        GLib.MainLoop = GlibMainLoopTest
23
24
    def tearDown(self):
25
        GLib.MainLoop = self.glib_main_loop
26
27
    def test_main(self):
28
        # Ensure we are able to setup dbus and create a mainloop
29
        with self.assertRaises(AssertionError):
30
            coala_dbus.main()
31
32
        with self.assertRaises(SystemExit):
33
            coala_dbus.sys_clean_exit()
34
35
        self.assertGreater(coala_dbus.on_disconnected(), 0)
36