[Commits] (twl) Cleanup imports
commits at osafoundation.org
commits at osafoundation.org
Sun Jan 4 22:44:29 PST 2004
Commit by: twl
Modified files:
osaf/chandler/Chandler/repository/tests/TestPerfWithRSS.py 1.5 1.6
Log message:
Cleanup imports
Improve behavior when RSS data is not present
do pass/fail code
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/repository/tests/TestPerfWithRSS.py.diff?r1=text&tr1=1.5&r2=text&tr2=1.6
Index: osaf/chandler/Chandler/repository/tests/TestPerfWithRSS.py
diff -u osaf/chandler/Chandler/repository/tests/TestPerfWithRSS.py:1.5 osaf/chandler/Chandler/repository/tests/TestPerfWithRSS.py:1.6
--- osaf/chandler/Chandler/repository/tests/TestPerfWithRSS.py:1.5 Sun Jan 4 22:19:18 2004
+++ osaf/chandler/Chandler/repository/tests/TestPerfWithRSS.py Sun Jan 4 22:43:59 2004
@@ -2,12 +2,12 @@
Simple Performance tests for Chandler repository
"""
-__revision__ = "$Revision: 1.5 $"
-__date__ = "$Date: 2004/01/05 06:19:18 $"
+__revision__ = "$Revision: 1.6 $"
+__date__ = "$Date: 2004/01/05 06:43:59 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
-import unittest, os
+import posix, os, os.path, sys, unittest
from bsddb.db import DBNoSuchFileError
from repository.persistence.XMLRepository import XMLRepository
@@ -15,17 +15,18 @@
import repository.parcel.LoadParcels as LoadParcels
import application.Globals as Globals
-import sys
-
+# get Zaobao's feedparser
_chandlerDir = os.environ['CHANDLERDIR']
sys.path.append(os.path.join(_chandlerDir,'parcels','OSAF','examples','zaobao'))
import feedparser
-import posix
+# get all the RSS files in RSS_HOME (repository/tests/data/rssfeeds)
+# You can obtain the files from http://aloha.osafoundation.org/~twl/rssfeeds.tar.gz
RSS_HOME=os.path.join(_chandlerDir,'repository','tests','data','rssfeeds/')
-
-# get all the RSS files in RSS_HOME
-_rssfiles = posix.listdir(RSS_HOME)
+if os.path.exists(RSS_HOME):
+ _rssfiles = posix.listdir(RSS_HOME)
+else:
+ _rssfiles = []
# make them file URL's
_defaultBlogs = [ "file://"+RSS_HOME+f for f in _rssfiles ]
@@ -37,7 +38,7 @@
def setUp(self):
self.rootdir = _chandlerDir
- self.rep = XMLRepository('RSSPerfUnitTest-Repository')
+ self.rep = XMLRepository('__repository__')
Globals.repository = self.rep # to keep indexer happy
self.rep.create()
schemaPack = os.path.join(self.rootdir, 'repository', 'packs', 'schema.pack')
@@ -75,7 +76,9 @@
repository.commit()
except Exception, e:
self.rep.logger.error("Final commit:",e)
+ self.fail()
self.rep.logger.info("Processed %d items" % itemCount)
+ self.assert_(True)
def __getFeeds(self):
"""Return a list of channel items"""
More information about the Commits
mailing list