Mercurial > treepkg
view test/test_info.py @ 509:c4288095887f
update git tag detector and add test
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Tue, 09 Nov 2010 14:54:55 +0000 |
parents | 8e0c81870e5e |
children | e5b66539f893 |
line wrap: on
line source
# Copyright (C) 2010 by Intevation GmbH # Authors: # Bjoern Ricks <bjoern.ricks@intevation.de> # # This program is free software under the GPL (>=v2) # Read the file COPYING coming with the software for details. """Tests for treepkg.status.status""" import unittest import os import sys from treepkg.info.status import TreepkgInfo, TreepkgRootInfo from filesupport import FileTestMixin from treepkg.publish import get_binary_arch class TreepkgInfoTest(unittest.TestCase, FileTestMixin): config_contents = """\ [DEFAULT] #treepkg_dir: /home/builder/mill #tracks_dir: %(treepkg_dir)s/tracks tracks_dir: /home/builder/mill/tracks root_cmd: sudo pbuilder_dir: %(tracks_dir)s/pbuilder builderconfig: %(pbuilder_dir)s/pbuilderrc deb_email: treepkg@example.com deb_fullname: TreePKG pkg_revision_template: treepkg%%(pkg_revision)s handle_dependencies: False [treepkg] instructions_file: %(tracks_dir)s/instructions check_interval: 3600 name: testtreepkginfo [pkg_simple] pkg_basename: simple1 svn_url: svn://example.com/%(name)s/trunk base_dir: %(tracks_dir)s/%(name)s packager_class: treepkginfo_test.%(name)s handle_dependencies: True signing_key_id: abcd1234 changelog_msg_template: Update to feature branch r%%(revision)s version_template: 1.0.svn%%(revision)s """ files = [("treepkg.cfg", config_contents), ("treepkginfo_test", [("__init__.py", ""), ("simple.py", "\n".join(["class SourcePackager:", " pass", ""])), ])] def setUp(self): self.directory = self.create_files("treepkg", self.files) self.old_path = sys.path sys.path = [self.directory] + sys.path def tearDown(self): sys.path = self.old_path def test_createinfo(self): config_file = os.path.join(self.directory, "treepkg.cfg") tpkginfo = TreepkgInfo(config_file) tpkgrootinfo = tpkginfo.tpkgroot.info self.assertEquals("testtreepkginfo", tpkgrootinfo.name) class TreepkgRootInfoTest(unittest.TestCase): def test_toxml(self): status = TreepkgRootInfo("testtreepkg") dom = status.toxml() xml = dom.toxml() self.assertEquals("<info><name>testtreepkg</name></info>", xml) class TestPublish(unittest.TestCase, FileTestMixin): def test_get_binary_arch(self): source = get_binary_arch("source") self.assertEquals("source", source) binary_armel = get_binary_arch("armel") self.assertEquals("binary-armel", binary_armel) binary_armel = get_binary_arch("binary-armel") self.assertEquals("binary-armel", binary_armel) if __name__ == '__main__': unittest.main()