Mercurial > treepkg
comparison test/test_packager.py @ 96:efbd66b13f51
Make PackagerTest more flexible to make it easier to add tests
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Mon, 26 Nov 2007 14:34:17 +0000 |
parents | 8f1c72135ea6 |
children | d85efd3276bd |
comparison
equal
deleted
inserted
replaced
95:8f1c72135ea6 | 96:efbd66b13f51 |
---|---|
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 for message, files in self.revisions: | 108 for message, files in self.revisions: |
109 add_svn_files(self.svnworkdir, files, message) | 109 add_svn_files(self.svnworkdir, files, message) |
110 | 110 |
111 def runtest(self, debrevision, **extra_track_args): | 111 def runtest(self, debrevision, group_args=None, **extra_track_args): |
112 rootcmd = os.path.join(os.path.dirname(__file__), os.pardir, "test", | 112 rootcmd = os.path.join(os.path.dirname(__file__), os.pardir, "test", |
113 "mocksudopbuilder.py") | 113 "mocksudopbuilder.py") |
114 track = PackageTrack(name="testpkg", base_dir=self.trackdir, | 114 track = PackageTrack(name="testpkg", base_dir=self.trackdir, |
115 svn_url=self.svn_url, pbuilderrc="", | 115 svn_url=self.svn_url, pbuilderrc="", |
116 root_cmd=[sys.executable, rootcmd], | 116 root_cmd=[sys.executable, rootcmd], |
117 deb_email="treepkg@example.com", | 117 deb_email="treepkg@example.com", |
118 deb_fullname="treepkg tester", | 118 deb_fullname="treepkg tester", |
119 **extra_track_args) | 119 **extra_track_args) |
120 group = PackagerGroup([track], 1) | 120 |
121 if group_args is None: | |
122 group_args = {} | |
123 group = PackagerGroup([track], 1, **group_args) | |
121 group.check_package_tracks() | 124 group.check_package_tracks() |
122 | 125 |
123 # determine version that has been packaged. This assumes that | 126 # determine version that has been packaged. This assumes that |
124 # check_package_tracks will leave the checkout in the revision | 127 # check_package_tracks will leave the checkout in the revision |
125 # that was actually packaged. | 128 # that was actually packaged. |
148 def test_default_debrevision_prefix(self): | 151 def test_default_debrevision_prefix(self): |
149 self.runtest("treepkg1") | 152 self.runtest("treepkg1") |
150 | 153 |
151 def test_custom_debrevision_prefix(self): | 154 def test_custom_debrevision_prefix(self): |
152 self.runtest("kk1", debrevision_prefix="kk") | 155 self.runtest("kk1", debrevision_prefix="kk") |
156 | |
157 | |
158 class TestPackerWithMultipleRevisions(PackagerTest): | |
159 | |
160 revisions = [ | |
161 ("Initial Revision", | |
162 [("README", "and miles to go before I sleep")]), | |
163 ("Add some code", | |
164 [("program.c", "int main(void) { return 0; }")]), | |
165 ("Add some more code", | |
166 [("another.c", "int main(void) { return 1; }")]), | |
167 ] | |
168 | |
169 def test_default_debrevision_prefix(self): | |
170 self.runtest("treepkg1") | |
171 self.runtest("treepkg1", group_args=dict(revision=3) | |
172 | |
153 | 173 |
154 class StoppingPackager(treepkg.packager.RevisionPackager): | 174 class StoppingPackager(treepkg.packager.RevisionPackager): |
155 | 175 |
156 def package(self): | 176 def package(self): |
157 pass | 177 pass |