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
![]() |
|||
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
|
|||
14 | def run(): |
||
15 | raise AssertionError |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
16 | |||
17 | |||
18 | class coalaDbusTest(unittest.TestCase): |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
19 | |||
20 | def setUp(self): |
||
21 | self.glib_main_loop = GLib.MainLoop |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
22 | GLib.MainLoop = GlibMainLoopTest |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
23 | |||
24 | def tearDown(self): |
||
25 | GLib.MainLoop = self.glib_main_loop |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
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
|
|||
30 | coala_dbus.main() |
||
31 | |||
32 | with self.assertRaises(SystemExit): |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
33 | coala_dbus.sys_clean_exit() |
||
34 | |||
35 | self.assertGreater(coala_dbus.on_disconnected(), 0) |
||
36 |