Mercurial > treepkg
annotate test/test_info.py @ 441:eadcb1bb54e2
Merged revisions 388-399 via svnmerge from
svn+ssh://svn.wald.intevation.org/treepkg/branches/treepkg-status
........
r388 | bricks | 2010-07-28 10:38:50 +0200 (Mi, 28 Jul 2010) | 3 lines
fix if statement
upload hook should be called if it's not empty
........
r389 | bricks | 2010-07-28 13:38:00 +0200 (Mi, 28 Jul 2010) | 2 lines
only rsync specified architectures from cachedir to publishdir
........
r390 | bricks | 2010-07-29 14:07:57 +0200 (Do, 29 Jul 2010) | 2 lines
introduced after_copy_hook and made rsync upload to publishdir optional
........
r391 | bricks | 2010-07-29 15:43:39 +0200 (Do, 29 Jul 2010) | 3 lines
publish package must be default to get original behaviour
be more verbose at publishing
........
r392 | bricks | 2010-07-29 16:50:53 +0200 (Do, 29 Jul 2010) | 2 lines
fix handling of showing only successfull builds together with num packages
........
r393 | bricks | 2010-07-29 16:52:42 +0200 (Do, 29 Jul 2010) | 2 lines
fixed typo
........
r394 | bricks | 2010-07-29 16:59:10 +0200 (Do, 29 Jul 2010) | 2 lines
fixed another typo
........
r395 | bricks | 2010-07-29 18:05:54 +0200 (Do, 29 Jul 2010) | 3 lines
fixed another typo
treepkg is really slow with many revisions
........
r396 | bricks | 2010-08-02 12:41:55 +0200 (Mo, 02 Aug 2010) | 2 lines
fixed typos
........
r397 | bricks | 2010-08-02 17:36:12 +0200 (Mo, 02 Aug 2010) | 3 lines
be more error prone in listing different files
not checking if a dir exists caused several errors if a build wasn't successful
........
r398 | bricks | 2010-08-05 18:21:47 +0200 (Do, 05 Aug 2010) | 2 lines
review changes
........
r399 | bricks | 2010-08-06 13:06:08 +0200 (Fr, 06 Aug 2010) | 4 lines
cleanup modules
fix test_info testcases
added testcases for remove_trailingslashes and expand_filename
........
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Fri, 06 Aug 2010 13:41:54 +0000 |
parents | 8e0c81870e5e |
children | e5b66539f893 |
rev | line source |
---|---|
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
1 # Copyright (C) 2010 by Intevation GmbH |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
2 # Authors: |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
3 # Bjoern Ricks <bjoern.ricks@intevation.de> |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
4 # |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
5 # This program is free software under the GPL (>=v2) |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
6 # Read the file COPYING coming with the software for details. |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
7 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
8 """Tests for treepkg.status.status""" |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
9 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
10 import unittest |
438 | 11 import os |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
12 import sys |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
13 |
438 | 14 from treepkg.info.status import TreepkgInfo, TreepkgRootInfo |
15 | |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
16 from filesupport import FileTestMixin |
439 | 17 from treepkg.publish import get_binary_arch |
413
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
18 |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
388
diff
changeset
|
19 class TreepkgInfoTest(unittest.TestCase, FileTestMixin): |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
20 config_contents = """\ |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
21 [DEFAULT] |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
388
diff
changeset
|
22 #treepkg_dir: /home/builder/mill |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
388
diff
changeset
|
23 #tracks_dir: %(treepkg_dir)s/tracks |
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
388
diff
changeset
|
24 tracks_dir: /home/builder/mill/tracks |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
25 root_cmd: sudo |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
388
diff
changeset
|
26 pbuilder_dir: %(tracks_dir)s/pbuilder |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
27 builderconfig: %(pbuilder_dir)s/pbuilderrc |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
28 deb_email: treepkg@example.com |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
29 deb_fullname: TreePKG |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
30 pkg_revision_template: treepkg%%(pkg_revision)s |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
31 handle_dependencies: False |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
32 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
33 [treepkg] |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
388
diff
changeset
|
34 instructions_file: %(tracks_dir)s/instructions |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
35 check_interval: 3600 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
36 name: testtreepkginfo |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
37 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
38 [pkg_simple] |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
39 pkg_basename: simple1 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
40 svn_url: svn://example.com/%(name)s/trunk |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
41 base_dir: %(tracks_dir)s/%(name)s |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
42 packager_class: treepkginfo_test.%(name)s |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
43 handle_dependencies: True |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
44 signing_key_id: abcd1234 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
45 changelog_msg_template: Update to feature branch r%%(revision)s |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
46 version_template: 1.0.svn%%(revision)s |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
47 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
48 """ |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
49 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
50 files = [("treepkg.cfg", config_contents), |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
51 ("treepkginfo_test", |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
52 [("__init__.py", ""), |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
53 ("simple.py", |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
54 "\n".join(["class SourcePackager:", |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
55 " pass", |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
56 ""])), |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
57 ])] |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
58 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
59 def setUp(self): |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
60 self.directory = self.create_files("treepkg", self.files) |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
61 self.old_path = sys.path |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
62 sys.path = [self.directory] + sys.path |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
63 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
64 def tearDown(self): |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
65 sys.path = self.old_path |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
66 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
67 def test_createinfo(self): |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
68 config_file = os.path.join(self.directory, "treepkg.cfg") |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
388
diff
changeset
|
69 tpkginfo = TreepkgInfo(config_file) |
413
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
70 tpkgrootinfo = tpkginfo.tpkgroot.info |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
71 self.assertEquals("testtreepkginfo", tpkgrootinfo.name) |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
72 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
73 |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
388
diff
changeset
|
74 class TreepkgRootInfoTest(unittest.TestCase): |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
75 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
76 def test_toxml(self): |
392
e2afbd3c2bf1
write first info about tracks
Bjoern Ricks <bricks@intevation.de>
parents:
388
diff
changeset
|
77 status = TreepkgRootInfo("testtreepkg") |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
78 dom = status.toxml() |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
79 xml = dom.toxml() |
413
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
80 self.assertEquals("<info><name>testtreepkg</name></info>", xml) |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
81 |
439 | 82 class TestPublish(unittest.TestCase, FileTestMixin): |
413
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
83 |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
84 def test_get_binary_arch(self): |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
85 source = get_binary_arch("source") |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
86 self.assertEquals("source", source) |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
87 binary_armel = get_binary_arch("armel") |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
88 self.assertEquals("binary-armel", binary_armel) |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
89 binary_armel = get_binary_arch("binary-armel") |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
90 self.assertEquals("binary-armel", binary_armel) |
94a6ae627b31
implemented CacheDb to store copied Packages from build host
Bjoern Ricks <bricks@intevation.de>
parents:
392
diff
changeset
|
91 |
388
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
92 |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
93 if __name__ == '__main__': |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
94 unittest.main() |
1af04bfbb1d0
moved test file to test main dir
Bjoern Ricks <bricks@intevation.de>
parents:
diff
changeset
|
95 |