annotate test/test_util.py @ 128:5155b4f9443d

Add basic dependency handling to PackageTrack and PackagerGroup. PackageTrack now extracts dependency information from the debian/control file and PackagerGroup sorts the tracks based on this information so that packages on which other packages in the group depend on are built first and their newly built binaries are installed added to the pbuilder instance. Also add some test cases.
author Bernhard Herzog <bh@intevation.de>
date Fri, 23 May 2008 16:11:22 +0000
parents 7f6fb8103db0
children 017179427c7f
rev   line source
111
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
1 # Copyright (C) 2007, 2008 by Intevation GmbH
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
2 # Authors:
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
3 # Bernhard Herzog <bh@intevation.de>
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
4 #
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
5 # This program is free software under the GPL (>=v2)
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
6 # Read the file COPYING coming with the software for details.
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
7
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
8 """Tests for the treepkg.util module"""
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
9
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
10 import unittest
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
11
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
12 from filesupport import FileTestMixin
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
13
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
14 from treepkg.util import replace_in_file
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
15
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
16
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
17 class TestReplaceInFile(unittest.TestCase, FileTestMixin):
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
18
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
19 def runtest(self, orig_contents, expected_contents, pattern, replacement):
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
20 filename = self.create_temp_file(self.id(), orig_contents)
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
21 replace_in_file(filename, pattern, replacement)
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
22 self.checkFileContents(filename, expected_contents)
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
23
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
24 def test_version_replacement(self):
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
25 template = ("project foo version 1.0-svn%(rev)d"
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
26 "Some filler"
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
27 "text that sometimes"
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
28 "looks similar to the pattern"
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
29 "1.0-"
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
30 "foo 1.2-svn2"
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
31 "echo foo version 1.0-svn%(rev)d"
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
32 ""
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
33 "and more filler")
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
34 self.runtest(template % dict(rev=0), template % dict(rev=321),
7f6fb8103db0 Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
35 r"1\.0-svn0", "1.0-svn321")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)