Failed Conditions
Pull Request — master (#2076)
by Abdeali
02:11
created

tests/coalaDbusTest.py (9 issues)

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:
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable ImportError does not seem to be defined.
Loading history...
8
    raise SkipTest("python-gi or python-dbus not installed")
9
10
11
class GlibMainLoopTest:
12
13
    @staticmethod
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable staticmethod does not seem to be defined.
Loading history...
14
    def run():
15
        raise AssertionError
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable AssertionError does not seem to be defined.
Loading history...
16
17
18
class coalaDbusTest(unittest.TestCase):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable unittest does not seem to be defined.
Loading history...
19
20
    def setUp(self):
21
        self.glib_main_loop = GLib.MainLoop
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable GLib does not seem to be defined.
Loading history...
22
        GLib.MainLoop = GlibMainLoopTest
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable GlibMainLoopTest does not seem to be defined.
Loading history...
23
24
    def tearDown(self):
25
        GLib.MainLoop = self.glib_main_loop
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable self does not seem to be defined.
Loading history...
26
27
    def test_main(self):
28
        # Ensure we are able to setup dbus and create a mainloop
29
        with self.assertRaises(AssertionError):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable AssertionError does not seem to be defined.
Loading history...
30
            coala_dbus.main()
31
32
        with self.assertRaises(SystemExit):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable SystemExit does not seem to be defined.
Loading history...
33
            coala_dbus.sys_clean_exit()
34
35
        self.assertGreater(coala_dbus.on_disconnected(), 0)
36