def tearDown(self): # Prevent processing of pending events after the test has finished: wx.GetApp().Disconnect(wx.ID_ANY) from taskcoachlib import patterns patterns.Publisher().clear() patterns.CommandHistory().clear() patterns.NumberedInstances.count = dict() from taskcoachlib.domain import date date.Clock().reset() if hasattr(self, 'events'): del self.events super(TestCase, self).tearDown()
def tearDown(self): # pylint: disable=W0404 # Prevent processing of pending events after the test has finished: wx.GetApp().Disconnect(wx.ID_ANY) from taskcoachlib import patterns patterns.Publisher().clear() patterns.CommandHistory().clear() patterns.NumberedInstances.count = dict() from taskcoachlib.domain import date date.Scheduler().shutdown(False, False) date.Scheduler.deleteInstance() if hasattr(self, 'events'): del self.events from taskcoachlib.thirdparty.pubsub import pub pub.unsubAll() super(TestCase, self).tearDown()
def testUndoMarkCompletedWhenFilteringCompletedTasks(self): self.viewer.hideCompletedTasks() child1 = task.Task('child1') child2 = task.Task('child2') grandChild = task.Task('grandChild') self.task.addChild(child1) self.task.addChild(child2) child2.addChild(grandChild) self.taskList.append(self.task) self.viewer.expandAll() self.assertEqual(4, self.viewer.size()) markCompletedCommand = command.MarkCompletedCommand( self.taskList, [grandChild]) markCompletedCommand.do() self.assertEqual(2, self.viewer.size()) patterns.CommandHistory().undo() self.assertEqual(4, self.viewer.size())
def testUndoMarkCompletedWhenFilteringCompletedTasks(self): self.settings.setboolean( 'behavior', 'markparentcompletedwhenallchildrencompleted', True) self.viewer.hideTaskStatus(task.status.completed) child1 = task.Task('child1') child2 = task.Task('child2') grandChild = task.Task('grandChild') self.task.addChild(child1) self.task.addChild(child2) child2.addChild(grandChild) self.taskList.append(self.task) self.viewer.expandAll() self.assertEqual(4, self.viewer.size()) markCompletedCommand = command.MarkCompletedCommand( self.taskList, [grandChild]) markCompletedCommand.do() self.assertEqual(2, self.viewer.size()) patterns.CommandHistory().undo() self.assertEqual(4, self.viewer.size())
def __closeUnconditionally(self): self.__messageCallback(_('Closed %s') % self.__taskFile.filename()) self.__taskFile.close() patterns.CommandHistory().clear() gc.collect()
def testCannotDropOnGrandchild(self): self.dragAndDrop([self.grandchild], [self.parent]) self.failIf(patterns.CommandHistory().hasHistory())
def testSingleton(self): another = patterns.CommandHistory() self.failUnless(self.commands is another)
def setUp(self): self.commands = patterns.CommandHistory() self.command = patterns.Command()
def assertHistoryAndFuture(self, expectedHistory, expectedFuture): from taskcoachlib import patterns commands = patterns.CommandHistory() self.assertEqual(expectedHistory, commands.getHistory()) self.assertEqual(expectedFuture, commands.getFuture())
def redo(self): patterns.CommandHistory().redo()
def undo(self): patterns.CommandHistory().undo()
def tearDown(self): super(CommandTestCase, self).tearDown() patterns.CommandHistory().clear()
def __closeUnconditionally(self): self.__messageCallback(_('Closed %s') % self.__taskFile.filename()) self.__taskFile.close() from taskcoachlib import patterns patterns.CommandHistory().clear()