1719
1719
def test_go_run_bad_release_pathlock(self):
1720
1720
"""If run went bad, release the pathlock."""
1722
self.cmd.run = lambda: defer.fail(ValueError())
1722
self.cmd.run = lambda: defer.fail(ValueError("error message"))
1723
1723
self.cmd._acquire_pathlock = lambda: defer.succeed(
1724
1724
lambda: called.append(True))
1731
self.fail("It didn't raise an exception!")
1732
1727
self.assertTrue(called)
1729
# check exception to assure a traceback was logged, and check the
1730
# messages in ERROR (the real logging level); finally, clean the
1731
# records as if we leave them with the exception the test will fail
1732
self.assertTrue(self.handler.check_exception(ValueError))
1733
self.assertTrue(self.handler.check_error("Error running the command",
1735
self.handler.records = []
1734
1737
def test_run_initial(self):
1735
1738
"""Call ._start, log, and set running."""
1737
self.cmd._start = lambda: called.append(True)# or defer.succeed(True)
1740
d = defer.Deferred()
1741
self.cmd._start = lambda: called.append(True) or d
1743
# run, and will lock in the _start
1740
self.assertFalse(self.cmd.running)
1741
1745
self.assertTrue(called)
1742
1746
self.assertTrue(self.handler.check_debug('starting'))
1748
# release the _start, check log and that it still not running
1750
self.assertTrue(self.handler.check_debug('started'))
1751
self.assertFalse(self.cmd.running)
1744
1753
def test_run_stop_if_cancelled_while_start(self):
1745
1754
"""Cancelled while _start."""
1746
1755
self.rq.queue(self.cmd)