Completed
Pull Request — master (#1511)
by Abdeali
01:35
created

coalib.tests.coalaDbusTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 13
Duplicated Lines 0 %
Metric Value
dl 0
loc 13
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A test_main() 0 4 2
A setUp() 0 3 1
A tearDown() 0 2 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