Failed Conditions
Pull Request — master (#1511)
by Abdeali
01:34
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
except ImportError:
7
    raise SkipTest("python-gi or python-dbus not installed")
8
9
10
class GlibMainLoopTest:
11
12
    @staticmethod
13
    def run(self):
0 ignored issues
show
Best Practice introduced by
Static method with 'self' as first argument
Loading history...
14
        raise AssertionError
15
16
17
class coalaDbusTest(unittest.TestCase):
18
19
    def setUp(self):
20
        self.glib_main_loop = GLib.MainLoop
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'GLib'
Loading history...
21
        GLib.MainLoop = GlibMainLoopTest
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'GLib'
Loading history...
22
23
    def tearDown(self):
24
        GLib.MainLoop = self.glib_main_loop
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'GLib'
Loading history...
25
26
    def test_main(self):
27
        # Ensure we are able to setup dbus and create a mainloop
28
        with self.assertRaises(AssertionError):
29
            coala_dbus.main()
30