comparison test/test_packager.py @ 95:8f1c72135ea6

Make PackagerTest more flexible to make it easier to add tests
author Bernhard Herzog <bh@intevation.de>
date Mon, 26 Nov 2007 14:28:47 +0000
parents 0c13a84a67dd
children efbd66b13f51
comparison
equal deleted inserted replaced
94:0c13a84a67dd 95:8f1c72135ea6
103 self.svnworkdir = self.create_temp_dir(self.id() + "-svnwork") 103 self.svnworkdir = self.create_temp_dir(self.id() + "-svnwork")
104 self.trackdir = self.create_temp_dir(self.id() + "-track") 104 self.trackdir = self.create_temp_dir(self.id() + "-track")
105 self.create_files(self.trackdir, self.debian_files) 105 self.create_files(self.trackdir, self.debian_files)
106 self.svn_url = create_svn_repository(self.svndir) + "/trunk" 106 self.svn_url = create_svn_repository(self.svndir) + "/trunk"
107 subversion.checkout(self.svn_url, self.svnworkdir) 107 subversion.checkout(self.svn_url, self.svnworkdir)
108 add_svn_files(self.svnworkdir, self.revisions[0], 108 for message, files in self.revisions:
109 "Initial version") 109 add_svn_files(self.svnworkdir, files, message)
110
111
112 class TestPackager(PackagerTest):
113
114 revisions = [
115 [("README", "and miles to go before I sleep")],
116 ]
117 110
118 def runtest(self, debrevision, **extra_track_args): 111 def runtest(self, debrevision, **extra_track_args):
119 rootcmd = os.path.join(os.path.dirname(__file__), os.pardir, "test", 112 rootcmd = os.path.join(os.path.dirname(__file__), os.pardir, "test",
120 "mocksudopbuilder.py") 113 "mocksudopbuilder.py")
121 track = PackageTrack(name="testpkg", base_dir=self.trackdir, 114 track = PackageTrack(name="testpkg", base_dir=self.trackdir,
125 deb_fullname="treepkg tester", 118 deb_fullname="treepkg tester",
126 **extra_track_args) 119 **extra_track_args)
127 group = PackagerGroup([track], 1) 120 group = PackagerGroup([track], 1)
128 group.check_package_tracks() 121 group.check_package_tracks()
129 122
123 # determine version that has been packaged. This assumes that
124 # check_package_tracks will leave the checkout in the revision
125 # that was actually packaged.
126 version = subversion.last_changed_revision(self.svn_url)
127
130 # Now check the source and binary package files 128 # Now check the source and binary package files
131 pkgdir = os.path.join(self.trackdir, "pkg", "2-1") 129 pkgdir = os.path.join(self.trackdir, "pkg", "%d-1" % version)
132 self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "src"))), 130 self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "src"))),
133 ["testpkg_2-%s.diff.gz" % debrevision, 131 [name % locals() for name in
134 "testpkg_2-%s.dsc" % debrevision, 132 ["testpkg_%(version)d-%(debrevision)s.diff.gz",
135 "testpkg_2.orig.tar.gz"]) 133 "testpkg_%(version)d-%(debrevision)s.dsc",
134 "testpkg_%(version)d.orig.tar.gz"]])
136 self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "binary"))), 135 self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "binary"))),
137 ["testpkg_2-%s_all.deb" % debrevision, 136 [name % locals() for name in
138 "testpkg_2-%s_i386.changes" % debrevision]) 137 ["testpkg_%(version)d-%(debrevision)s_all.deb",
138 "testpkg_%(version)d-%(debrevision)s_i386.changes"]])
139
140
141 class TestPackager(PackagerTest):
142
143 revisions = [
144 ("Initial Revision",
145 [("README", "and miles to go before I sleep")]),
146 ]
139 147
140 def test_default_debrevision_prefix(self): 148 def test_default_debrevision_prefix(self):
141 self.runtest("treepkg1") 149 self.runtest("treepkg1")
142 150
143 def test_custom_debrevision_prefix(self): 151 def test_custom_debrevision_prefix(self):
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)