[Spambayes-checkins] SF.net SVN: spambayes:[3233] trunk/spambayes/spambayes/test/test_storage.py
montanaro at users.sourceforge.net
montanaro at users.sourceforge.net
Tue Jan 27 13:33:03 CET 2009
Revision: 3233
http://spambayes.svn.sourceforge.net/spambayes/?rev=3233&view=rev
Author: montanaro
Date: 2009-01-27 12:33:03 +0000 (Tue, 27 Jan 2009)
Log Message:
-----------
Many db types add suffixes. Remove all files with db_name as prefix.
Modified Paths:
--------------
trunk/spambayes/spambayes/test/test_storage.py
Modified: trunk/spambayes/spambayes/test/test_storage.py
===================================================================
--- trunk/spambayes/spambayes/test/test_storage.py 2009-01-27 12:31:49 UTC (rev 3232)
+++ trunk/spambayes/spambayes/test/test_storage.py 2009-01-27 12:33:03 UTC (rev 3233)
@@ -1,6 +1,7 @@
# Test the basic storage operations of the classifier.
import unittest, os, sys
+import glob
import tempfile
import cStringIO as StringIO
@@ -21,8 +22,9 @@
def tearDown(self):
self.classifier.close()
self.classifier = None
- if os.path.isfile(self.db_name):
- os.remove(self.db_name)
+ for name in glob.glob(self.db_name+"*"):
+ if os.path.isfile(name):
+ os.remove(name)
def testLoadAndStore(self):
# Simple test to verify that putting data in the db, storing and
@@ -70,7 +72,7 @@
if info is None:
if expected_ham == expected_spam == 0:
return
- self.fail("_CheckWordCounts for '%s' got None!")
+ self.fail("_CheckWordCounts for '%s' got None!" % word)
if info.hamcount != expected_ham:
self.fail("Hamcount '%s' wrong - got %d, but expected %d" \
% (word, info.hamcount, expected_ham))
@@ -189,8 +191,9 @@
finally:
DBDictClassifier.load = DBDictClassifier_load
- if os.path.isfile(db_name):
- os.remove(db_name)
+ for name in glob.glob(db_name+"*"):
+ if os.path.isfile(name):
+ os.remove(name)
class CDBStorageTestCase(_StorageTestBase):
StorageClass = CDBClassifier
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Spambayes-checkins
mailing list