Commits

Jason R. Coombs committed 7ea7e73

Fixed issue where feeds weren't being loaded from the database (because set.__init__ was being called after .update).

  • Participants
  • Parent commits f2e6b46
  • Tags 1104.4b4

Comments (0)

Files changed (2)

File pmxbot/rss.py

 	A database-backed set of feed entries that have been seen before.
 	"""
 	def __init__(self, db_uri=None):
+		super(FeedHistory, self).__init__()
 		db_uri = db_uri or pmxbot.config.database
 		self.store = FeedparserDB.from_URI(db_uri)
 		timer = timing.Stopwatch()
 		self.update(self.store.get_seen_feeds())
 		log.info("Loaded feed history in %s", timer.split())
 		storage.SelectableStorage._finalizers.append(self.__finalize)
-		super(FeedHistory, self).__init__()
 
 	def __finalize(self):
 		del self.store
 
 	def clear(self):
 		"Clear all entries"
-		self.db.remove()
+		self.db.remove(safe=True)

File tests/unit/test_rss.py

 @pytest.fixture()
 def history(db_uri, request):
 	history = pmxbot.rss.FeedHistory(db_uri)
+	request.addfinalizer(history.store.clear)
 	request.addfinalizer(history._FeedHistory__finalize)
 	return history
 
 		orig_uri = history.store.uri
 		new_history = pmxbot.rss.FeedHistory(orig_uri)
 		assert len(new_history) == 1
-		assert new_history.add_seen_feed(entry) is False
+		assert new_history.add_seen_feed(entry, 'http://example.com') is False