[Treepkg-commits] r20 - trunk/test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Nov 26 15:28:47 CET 2007
Author: bh
Date: 2007-11-26 15:28:47 +0100 (Mon, 26 Nov 2007)
New Revision: 20
Modified:
trunk/test/test_packager.py
Log:
Make PackagerTest more flexible to make it easier to add tests
Modified: trunk/test/test_packager.py
===================================================================
--- trunk/test/test_packager.py 2007-11-26 14:15:52 UTC (rev 19)
+++ trunk/test/test_packager.py 2007-11-26 14:28:47 UTC (rev 20)
@@ -105,16 +105,9 @@
self.create_files(self.trackdir, self.debian_files)
self.svn_url = create_svn_repository(self.svndir) + "/trunk"
subversion.checkout(self.svn_url, self.svnworkdir)
- add_svn_files(self.svnworkdir, self.revisions[0],
- "Initial version")
+ for message, files in self.revisions:
+ add_svn_files(self.svnworkdir, files, message)
-
-class TestPackager(PackagerTest):
-
- revisions = [
- [("README", "and miles to go before I sleep")],
- ]
-
def runtest(self, debrevision, **extra_track_args):
rootcmd = os.path.join(os.path.dirname(__file__), os.pardir, "test",
"mocksudopbuilder.py")
@@ -127,16 +120,31 @@
group = PackagerGroup([track], 1)
group.check_package_tracks()
+ # determine version that has been packaged. This assumes that
+ # check_package_tracks will leave the checkout in the revision
+ # that was actually packaged.
+ version = subversion.last_changed_revision(self.svn_url)
+
# Now check the source and binary package files
- pkgdir = os.path.join(self.trackdir, "pkg", "2-1")
+ pkgdir = os.path.join(self.trackdir, "pkg", "%d-1" % version)
self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "src"))),
- ["testpkg_2-%s.diff.gz" % debrevision,
- "testpkg_2-%s.dsc" % debrevision,
- "testpkg_2.orig.tar.gz"])
+ [name % locals() for name in
+ ["testpkg_%(version)d-%(debrevision)s.diff.gz",
+ "testpkg_%(version)d-%(debrevision)s.dsc",
+ "testpkg_%(version)d.orig.tar.gz"]])
self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "binary"))),
- ["testpkg_2-%s_all.deb" % debrevision,
- "testpkg_2-%s_i386.changes" % debrevision])
+ [name % locals() for name in
+ ["testpkg_%(version)d-%(debrevision)s_all.deb",
+ "testpkg_%(version)d-%(debrevision)s_i386.changes"]])
+
+class TestPackager(PackagerTest):
+
+ revisions = [
+ ("Initial Revision",
+ [("README", "and miles to go before I sleep")]),
+ ]
+
def test_default_debrevision_prefix(self):
self.runtest("treepkg1")
More information about the Treepkg-commits
mailing list