"Class %r from %r imported.",
'LockHandler', 'webhooks.lock_handler')
+ # -------------------------------------------------------------------------
+ def test_could_not_occupy_lockfile_error(self):
+
+ LOG.info("Test raising a CouldntOccupyLockfileError exception ...")
+
+ from webhooks.errors import CouldntOccupyLockfileError
+
+ with self.assertRaises(CouldntOccupyLockfileError) as cm:
+ raise CouldntOccupyLockfileError('/var/lock/bla.lock', 9.1, 5)
+ e = cm.exception
+ LOG.debug("%s raised: %s", e.__class__.__name__, e)
+
+ # -------------------------------------------------------------------------
+ def test_object(self):
+
+ LOG.info("Testing init of a simple object.")
+
+ from webhooks.lock_handler import LockHandler
+
+ locker = LockHandler(
+ appname='test_base_object',
+ verbose=self.verbose,
+ lockdir='/tmp',
+ )
+ LOG.debug("LockHandler %%r:\n%r", locker)
+ LOG.debug("LockHandler %%s:\n%s", str(locker))
+
+
# =============================================================================
if verbose is None:
verbose = 0
init_root_logger(verbose)
-
+
LOG.info("Starting tests ...")
loader = unittest.TestLoader()
suite = unittest.TestSuite()
-
+
suite.addTest(TestLockHandler('test_import', verbose))
-
+ suite.addTest(TestLockHandler('test_could_not_occupy_lockfile_error', verbose))
+ suite.addTest(TestLockHandler('test_object', verbose))
+
runner = unittest.TextTestRunner(verbosity=verbose)
result = runner.run(suite)
# =============================================================================
-# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 LIST
-
-
-
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 list