comparison test/test_packager.py @ 94:0c13a84a67dd

refactor the packager test cases to prepare for more tests
author Bernhard Herzog <bh@intevation.de>
date Mon, 26 Nov 2007 14:15:52 +0000
parents 73c67372c7f7
children 8f1c72135ea6
comparison
equal deleted inserted replaced
93:73c67372c7f7 94:0c13a84a67dd
68 class PackageTrack(treepkg.packager.PackageTrack): 68 class PackageTrack(treepkg.packager.PackageTrack):
69 69
70 revision_packager_cls = RevisionPackager 70 revision_packager_cls = RevisionPackager
71 71
72 72
73 class TestPackager(unittest.TestCase, FileTestMixin): 73 class PackagerTest(unittest.TestCase, FileTestMixin):
74 74
75 initial_files = [ 75 revisions = []
76 ("README", "and miles to go before I sleep"),
77 ]
78 76
79 debian_files = [ 77 debian_files = [
80 ("debian", 78 ("debian",
81 [("control", """\ 79 [("control", """\
82 Source: testpkg 80 Source: testpkg
97 95
98 -- TreePKG <treepkg@example.com> Thu, 8 Mar 2007 18:34:39 +0100 96 -- TreePKG <treepkg@example.com> Thu, 8 Mar 2007 18:34:39 +0100
99 """), 97 """),
100 ("rules", "binary: echo binary")])] 98 ("rules", "binary: echo binary")])]
101 99
100
102 def setUp(self): 101 def setUp(self):
103 self.svndir = self.create_temp_dir(self.id() + "-svn") 102 self.svndir = self.create_temp_dir(self.id() + "-svn")
104 self.svnworkdir = self.create_temp_dir(self.id() + "-svnwork") 103 self.svnworkdir = self.create_temp_dir(self.id() + "-svnwork")
105 self.trackdir = self.create_temp_dir(self.id() + "-track") 104 self.trackdir = self.create_temp_dir(self.id() + "-track")
106 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"
107 subversion.checkout(self.svn_url, self.svnworkdir)
108 add_svn_files(self.svnworkdir, self.revisions[0],
109 "Initial version")
110
111
112 class TestPackager(PackagerTest):
113
114 revisions = [
115 [("README", "and miles to go before I sleep")],
116 ]
107 117
108 def runtest(self, debrevision, **extra_track_args): 118 def runtest(self, debrevision, **extra_track_args):
109 baseurl = create_svn_repository(self.svndir)
110 svn_url = baseurl + "/trunk"
111 subversion.checkout(svn_url, self.svnworkdir)
112 add_svn_files(self.svnworkdir, self.initial_files,
113 "Initial version")
114 rootcmd = os.path.join(os.path.dirname(__file__), os.pardir, "test", 119 rootcmd = os.path.join(os.path.dirname(__file__), os.pardir, "test",
115 "mocksudopbuilder.py") 120 "mocksudopbuilder.py")
116 track = PackageTrack(name="testpkg", base_dir=self.trackdir, 121 track = PackageTrack(name="testpkg", base_dir=self.trackdir,
117 svn_url=svn_url, pbuilderrc="", 122 svn_url=self.svn_url, pbuilderrc="",
118 root_cmd=[sys.executable, rootcmd], 123 root_cmd=[sys.executable, rootcmd],
119 deb_email="treepkg@example.com", 124 deb_email="treepkg@example.com",
120 deb_fullname="treepkg tester", 125 deb_fullname="treepkg tester",
121 **extra_track_args) 126 **extra_track_args)
122 group = PackagerGroup([track], 1) 127 group = PackagerGroup([track], 1)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)