示例#1
0
 def test_19823_case2(self):
     # Test a variation on the 19823 issue.
     item = self.tracked_items[0]
     item2 = self.tracked_items[1]
     # make a change where the ItemTracker just needs to refresh the data
     item.title = u'new title'
     item.signal_change()
     msg = self.get_items_changed_message()
     # make it so that we remove an item right after refresh_items() is
     # called
     old_refresh_items = self.tracker.item_fetcher.refresh_items
     def refresh_items_intercept(changed_ids):
         # call originial version
         rv = old_refresh_items(changed_ids)
         item2.remove()
         app.db.finish_transaction()
         return rv
     self.tracker.item_fetcher.refresh_items = refresh_items_intercept
     # make another change that removes an item before the first one is
     # processed.  This provokes the race condition in 19823.
     # process the first message, the issue for 19823 was this caused us to
     # commit the transaction which makes sqlite see both changes.  The
     # ItemTracker still has item in it's list, but when it tries to read
     # it from its database connection, it's not there
     self.tracker.on_item_changes(msg)
     # check that get_items() doesn't raise an exception
     self.tracker.get_items()
示例#2
0
    def test_19823_case2(self):
        # Test a variation on the 19823 issue.
        item = self.tracked_items[0]
        item2 = self.tracked_items[1]
        # make a change where the ItemTracker just needs to refresh the data
        item.title = u'new title'
        item.signal_change()
        msg = self.get_items_changed_message()
        # make it so that we remove an item right after refresh_items() is
        # called
        old_refresh_items = self.tracker.item_fetcher.refresh_items

        def refresh_items_intercept(changed_ids):
            # call originial version
            rv = old_refresh_items(changed_ids)
            item2.remove()
            app.db.finish_transaction()
            return rv

        self.tracker.item_fetcher.refresh_items = refresh_items_intercept
        # make another change that removes an item before the first one is
        # processed.  This provokes the race condition in 19823.
        # process the first message, the issue for 19823 was this caused us to
        # commit the transaction which makes sqlite see both changes.  The
        # ItemTracker still has item in it's list, but when it tries to read
        # it from its database connection, it's not there
        self.tracker.on_item_changes(msg)
        # check that get_items() doesn't raise an exception
        self.tracker.get_items()
示例#3
0
 def test_19866(self):
     # variation on 19823 where the crash happens while handling the
     # will-change signal.
     item = self.tracked_items[0]
     item2 = self.tracked_items[1]
     # make a change where the ItemTracker just needs to refresh the data
     item.title = u'new title'
     item.signal_change()
     msg1 = self.get_items_changed_message()
     # make another change that removes an item before the first one is
     # processed.  This provokes the race condition in 19823.
     item2.remove()
     msg2 = self.get_items_changed_message()
     # process the first message and check that get_items() doesn't crash
     # when it's called inside signal handlers
     self.tracker.connect('will-change',
                          lambda tracker: tracker.get_items())
     self.tracker.connect('list-changed', 
                          lambda tracker: tracker.get_items())
     self.tracker.on_item_changes(msg1)
     # process the second message
     self.tracker.on_item_changes(msg2)
示例#4
0
 def test_19823(self):
     # Test the tricky case from bz19823.
     item = self.tracked_items[0]
     item2 = self.tracked_items[1]
     # make a change where the ItemTracker just needs to refresh the data
     item.title = u'new title'
     item.signal_change()
     msg1 = self.get_items_changed_message()
     # make another change that removes an item before the first one is
     # processed.  This provokes the race condition in 19823.
     item2.remove()
     msg2 = self.get_items_changed_message()
     # process the first message, the issue for 19823 was this caused us to
     # commit the transaction which makes sqlite see both changes.  The
     # ItemTracker still has item in it's list, but when it tries to read
     # it from its database connection, it's not there
     self.tracker.on_item_changes(msg1)
     # check that get_items() doesn't raise an exception
     self.tracker.get_items()
     # process the second change for good measure
     self.tracker.on_item_changes(msg2)
     self.tracker.get_items()
示例#5
0
 def test_19866(self):
     # variation on 19823 where the crash happens while handling the
     # will-change signal.
     item = self.tracked_items[0]
     item2 = self.tracked_items[1]
     # make a change where the ItemTracker just needs to refresh the data
     item.title = u'new title'
     item.signal_change()
     msg1 = self.get_items_changed_message()
     # make another change that removes an item before the first one is
     # processed.  This provokes the race condition in 19823.
     item2.remove()
     msg2 = self.get_items_changed_message()
     # process the first message and check that get_items() doesn't crash
     # when it's called inside signal handlers
     self.tracker.connect('will-change',
                          lambda tracker: tracker.get_items())
     self.tracker.connect('list-changed',
                          lambda tracker: tracker.get_items())
     self.tracker.on_item_changes(msg1)
     # process the second message
     self.tracker.on_item_changes(msg2)
示例#6
0
 def test_19823(self):
     # Test the tricky case from bz19823.
     item = self.tracked_items[0]
     item2 = self.tracked_items[1]
     # make a change where the ItemTracker just needs to refresh the data
     item.title = u'new title'
     item.signal_change()
     msg1 = self.get_items_changed_message()
     # make another change that removes an item before the first one is
     # processed.  This provokes the race condition in 19823.
     item2.remove()
     msg2 = self.get_items_changed_message()
     # process the first message, the issue for 19823 was this caused us to
     # commit the transaction which makes sqlite see both changes.  The
     # ItemTracker still has item in it's list, but when it tries to read
     # it from its database connection, it's not there
     self.tracker.on_item_changes(msg1)
     # check that get_items() doesn't raise an exception
     self.tracker.get_items()
     # process the second change for good measure
     self.tracker.on_item_changes(msg2)
     self.tracker.get_items()