[Treepkg-commits] r348 - in branches/treepkg-status: test treepkg/info
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jul 8 15:25:07 CEST 2010
Author: bricks
Date: 2010-07-08 15:25:07 +0200 (Thu, 08 Jul 2010)
New Revision: 348
Added:
branches/treepkg-status/test/test_info.py
Removed:
branches/treepkg-status/test/status/
Modified:
branches/treepkg-status/treepkg/info/status.py
Log:
moved test file to test main dir
fixed missing : after def statement
Copied: branches/treepkg-status/test/test_info.py (from rev 346, branches/treepkg-status/test/status/test_status.py)
===================================================================
--- branches/treepkg-status/test/status/test_status.py 2010-07-07 15:40:48 UTC (rev 346)
+++ branches/treepkg-status/test/test_info.py 2010-07-08 13:25:07 UTC (rev 348)
@@ -0,0 +1,86 @@
+# Copyright (C) 2010 by Intevation GmbH
+# Authors:
+# Bjoern Ricks <bjoern.ricks at 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.path
+import sys
+
+test_dir = os.path.dirname(__file__)
+sys.path.append(os.path.join(test_dir, os.pardir))
+
+from treepkg.info.status import TreepkgInfo
+from treepkg.report import get_packager_group
+from filesupport import FileTestMixin
+
+class TreepkgInfoExampleTest(unittest.TestCase, FileTestMixin):
+ config_contents = """\
+[DEFAULT]
+treepkg_dir: /home/builder/mill
+tracks_dir: %(treepkg_dir)s/tracks
+root_cmd: sudo
+pbuilder_dir: %(treepkg_dir)s/pbuilder
+builderconfig: %(pbuilder_dir)s/pbuilderrc
+deb_email: treepkg at example.com
+deb_fullname: TreePKG
+pkg_revision_template: treepkg%%(pkg_revision)s
+handle_dependencies: False
+
+[treepkg]
+instructions_file: %(treepkg_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")
+ group = get_packager_group(config_file)
+ tpginfo = TreepkgInfo(group.name)
+ print tpginfo.toxml().toxml()
+ self.assertEquals("testtreepkginfo", tpginfo.name)
+
+
+class TreepkgInfoTest(unittest.TestCase):
+
+ def test_toxml(self):
+ status = TreepkgInfo("testtreepkg")
+ dom = status.toxml()
+ xml = dom.toxml()
+ self.assertEquals("<status><name>testtreepkg</name></status>", xml)
+
+if __name__ == '__main__':
+ unittest.main()
+
Property changes on: branches/treepkg-status/test/test_info.py
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: branches/treepkg-status/treepkg/info/status.py
===================================================================
--- branches/treepkg-status/treepkg/info/status.py 2010-07-08 10:07:39 UTC (rev 347)
+++ branches/treepkg-status/treepkg/info/status.py 2010-07-08 13:25:07 UTC (rev 348)
@@ -21,7 +21,7 @@
root = doc.documentElement
return (doc, root)
-class TreepkgStatus:
+class TreepkgInfo:
def __init__(self, name, treepkgpath=None, millpath=None, version=None):
self.name = name
@@ -150,7 +150,7 @@
self.name = name
self.path = path
- def toxml(self)
+ def toxml(self):
(doc, root) = createTpkgRoot("log")
# add <name>
nameele = createTpkgElement(doc, "name")
More information about the Treepkg-commits
mailing list