changeset 85:31b0567df051

Make PackageTrack.get_revision_numbers return the revisions as a sorted list. Add a test case for this.
author Bernhard Herzog <bh@intevation.de>
date Tue, 11 Sep 2007 09:53:34 +0000
parents 98a7d70746a9
children 9bd92a3290e0
files test/test_packager.py treepkg/packager.py
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_packager.py	Mon Sep 10 17:13:33 2007 +0000
+++ b/test/test_packager.py	Tue Sep 11 09:53:34 2007 +0000
@@ -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])
--- a/treepkg/packager.py	Mon Sep 10 17:13:33 2007 +0000
+++ b/treepkg/packager.py	Tue Sep 11 09:53:34 2007 +0000
@@ -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):
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)