for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import unittest
from unittest.case import SkipTest
try:
from coalib import coala_dbus
from gi.repository import GLib
except ImportError:
ImportError
raise SkipTest("python-gi or python-dbus not installed")
class GlibMainLoopTest:
@staticmethod
staticmethod
def run():
raise AssertionError
AssertionError
class coalaDbusTest(unittest.TestCase):
unittest
def setUp(self):
self.glib_main_loop = GLib.MainLoop
GLib
GLib.MainLoop = GlibMainLoopTest
GlibMainLoopTest
def tearDown(self):
GLib.MainLoop = self.glib_main_loop
self
def test_main(self):
# Ensure we are able to setup dbus and create a mainloop
with self.assertRaises(AssertionError):
coala_dbus.main()
with self.assertRaises(SystemExit):
SystemExit
coala_dbus.sys_clean_exit()
self.assertGreater(coala_dbus.on_disconnected(), 0)