[csw-devel] SF.net SVN: gar:[8480] csw/mgar/gar/v2
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Thu Feb 11 10:12:46 CET 2010
Revision: 8480
http://gar.svn.sourceforge.net/gar/?rev=8480&view=rev
Author: wahwah
Date: 2010-02-11 09:12:46 +0000 (Thu, 11 Feb 2010)
Log Message:
-----------
mGAR v2: tests, added a test case for overrides
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/opencsw.py
csw/mgar/gar/v2/tests/run_tests.py
Added Paths:
-----------
csw/mgar/gar/v2/tests/overrides_test.py
Modified: csw/mgar/gar/v2/lib/python/opencsw.py
===================================================================
--- csw/mgar/gar/v2/lib/python/opencsw.py 2010-02-11 09:04:10 UTC (rev 8479)
+++ csw/mgar/gar/v2/lib/python/opencsw.py 2010-02-11 09:12:46 UTC (rev 8480)
@@ -726,7 +726,16 @@
else:
return list()
+ def GetFileContent(self, pkg_file_path):
+ if pkg_file_path.startswith("/"):
+ pkg_file_path = pkg_file_path[1:]
+ file_path = os.path.join(self.directory, "root", pkg_file_path)
+ fd = open(file_path, "r")
+ content = fd.read()
+ fd.close()
+ return content
+
class Pkgmap(object):
"""Represents the pkgmap of the package.
Added: csw/mgar/gar/v2/tests/overrides_test.py
===================================================================
--- csw/mgar/gar/v2/tests/overrides_test.py (rev 0)
+++ csw/mgar/gar/v2/tests/overrides_test.py 2010-02-11 09:12:46 UTC (rev 8480)
@@ -0,0 +1,25 @@
+# $Id$
+
+import os.path
+import sys
+import unittest
+sys.path.append("../lib/python")
+import gartest
+
+class OverridesUnitTest(unittest.TestCase):
+ """Tests CHECKPKG_OVERRIDES support."""
+
+ def testPkginfoName(self):
+ """Checks that the GARNAME makes it to the NAME in pkginfo."""
+ mybuild = gartest.DynamicGarBuild()
+ mybuild.SetGarVariable("GARNAME", "overrides-test")
+ mybuild.SetGarVariable("CATALOGNAME", "overrides_test")
+ mybuild.SetGarVariable("CHECKPKG_OVERRIDES", "CSWoverrides-test|example-tag|example-parameter")
+ mybuild.WriteGarFiles()
+ self.assertEquals(0, mybuild.Build())
+ pkg = mybuild.GetFirstBuiltPackage()
+ overr_file = "/opt/csw/share/checkpkg/overrides/overrides_test"
+ expected = 'CSWoverrides-test: example-tag example-parameter\n'
+ self.assertEqual(expected, pkg.GetFileContent(overr_file))
+ overrides = pkg.GetOverrides()
+ self.assertEqual(1, len(overrides))
Property changes on: csw/mgar/gar/v2/tests/overrides_test.py
___________________________________________________________________
Added: svn:keywords
+ Id
Modified: csw/mgar/gar/v2/tests/run_tests.py
===================================================================
--- csw/mgar/gar/v2/tests/run_tests.py 2010-02-11 09:04:10 UTC (rev 8479)
+++ csw/mgar/gar/v2/tests/run_tests.py 2010-02-11 09:12:46 UTC (rev 8480)
@@ -10,9 +10,10 @@
# To add more test files, create <name>.py file and add a corresponding line
# here:
-from opencsw_test import *
-from checkpkg_test import *
-from example_test import *
+from opencsw_test import *
+from checkpkg_test import *
+from example_test import *
+from overrides_test import *
if __name__ == '__main__':
unittest.main()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list