[Treepkg-commits] r10 - in trunk: test treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Sep 11 11:53:34 CEST 2007


Author: bh
Date: 2007-09-11 11:53:34 +0200 (Tue, 11 Sep 2007)
New Revision: 10

Modified:
   trunk/test/test_packager.py
   trunk/treepkg/packager.py
Log:

Make PackageTrack.get_revision_numbers return the revisions as a sorted
list.  Add a test case for this.


Modified: trunk/test/test_packager.py
===================================================================
--- trunk/test/test_packager.py	2007-09-10 17:15:11 UTC (rev 9)
+++ trunk/test/test_packager.py	2007-09-11 09:53:34 UTC (rev 10)
@@ -130,3 +130,27 @@
         self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "binary"))),
                           ["testpkg_2-kk1_all.deb",
                            "testpkg_2-kk1_i386.changes"])
+
+
+class TestPackageTrack(unittest.TestCase, FileTestMixin):
+
+    track_files = [("pkg",
+                    [("704195-1",
+                      [("status", ""),
+                       ("src", []),
+                       ("binary", [])]),
+                     # Note: The revisions are not ordered so that we
+                     # can check whether get_revision_numbers returns a
+                     # sorted list of revisions
+                     ("702432-1",
+                      [("status", ""),
+                       ("src", []),
+                       ("binary", [])])])]
+
+    def setUp(self):
+        self.trackdir = self.create_temp_dir(self.id() + "-track")
+        self.create_files(self.trackdir, self.track_files)
+
+    def test_get_revision_numbers(self):
+        track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "")
+        self.assertEquals(track.get_revision_numbers(), [702432, 704195])

Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py	2007-09-10 17:15:11 UTC (rev 9)
+++ trunk/treepkg/packager.py	2007-09-11 09:53:34 UTC (rev 10)
@@ -301,6 +301,7 @@
                 match = self.pkg_dir_regex.match(filename)
                 if match:
                     revisions.append(int(match.group("revision")))
+        revisions.sort()
         return revisions
 
     def last_packaged_revision(self):



More information about the Treepkg-commits mailing list