[Zodb-checkins] SVN: ZODB/branches/tseaver-lp143158-feature/src/ZODB/scripts/ Test and fix for bug found reading checkin diffs.

Tres Seaver tseaver at palladion.com
Sun Dec 20 10:38:45 EST 2009


Log message for revision 106810:
  Test and fix for bug found reading checkin diffs.

Changed:
  U   ZODB/branches/tseaver-lp143158-feature/src/ZODB/scripts/repozo.py
  U   ZODB/branches/tseaver-lp143158-feature/src/ZODB/scripts/tests/test_repozo.py

-=-
Modified: ZODB/branches/tseaver-lp143158-feature/src/ZODB/scripts/repozo.py
===================================================================
--- ZODB/branches/tseaver-lp143158-feature/src/ZODB/scripts/repozo.py	2009-12-20 15:29:19 UTC (rev 106809)
+++ ZODB/branches/tseaver-lp143158-feature/src/ZODB/scripts/repozo.py	2009-12-20 15:38:45 UTC (rev 106810)
@@ -381,7 +381,7 @@
     full = []
     for fname in all:
         root, ext = os.path.splitext(fname)
-        if ext in ('.fs', 'fsz'):
+        if ext in ('.fs', '.fsz'):
             full.append(fname)
         if ext in ('.fs', '.fsz', '.deltafs', '.deltafsz'):
             deletable.append(fname)

Modified: ZODB/branches/tseaver-lp143158-feature/src/ZODB/scripts/tests/test_repozo.py
===================================================================
--- ZODB/branches/tseaver-lp143158-feature/src/ZODB/scripts/tests/test_repozo.py	2009-12-20 15:29:19 UTC (rev 106809)
+++ ZODB/branches/tseaver-lp143158-feature/src/ZODB/scripts/tests/test_repozo.py	2009-12-20 15:38:45 UTC (rev 106810)
@@ -235,6 +235,25 @@
             fqn = os.path.join(self._repository_directory, name)
             self.failUnless(os.path.isfile(fqn))
 
+    def test_removes_older_repozo_files_zipped(self):
+        OLDER_FULL = ['2009-12-20-00-01-03.fsz', '2009-12-20-00-01-03.dat']
+        DELTAS = ['2009-12-21-00-00-01.deltafsz',
+                  '2009-12-22-00-00-01.deltafsz']
+        CURRENT_FULL = ['2009-12-23-00-00-01.fsz', '2009-12-23-00-00-01.dat']
+        FILENAMES = OLDER_FULL + DELTAS + CURRENT_FULL
+        self._callFUT(filenames=FILENAMES)
+        remaining = os.listdir(self._repository_directory)
+        self.assertEqual(len(remaining), len(CURRENT_FULL))
+        for name in OLDER_FULL:
+            fqn = os.path.join(self._repository_directory, name)
+            self.failIf(os.path.isfile(fqn))
+        for name in DELTAS:
+            fqn = os.path.join(self._repository_directory, name)
+            self.failIf(os.path.isfile(fqn))
+        for name in CURRENT_FULL:
+            fqn = os.path.join(self._repository_directory, name)
+            self.failUnless(os.path.isfile(fqn))
+
 def test_suite():
     return unittest.TestSuite([
         unittest.makeSuite(RepozoTests),



More information about the Zodb-checkins mailing list