[csw-devel] SF.net SVN: gar:[11820] csw/mgar/gar/v2-fortran/lib/python/opencsw_test.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Dec 6 23:33:25 CET 2010


Revision: 11820
          http://gar.svn.sourceforge.net/gar/?rev=11820&view=rev
Author:   wahwah
Date:     2010-12-06 22:33:25 +0000 (Mon, 06 Dec 2010)

Log Message:
-----------
mGAR v2-fortran: Bringing the opencsw_test.py file in sync with v2

I don't know how did it get out of sync; there was a conflict during merge and
I apparently resolved it the wrong way.

Modified Paths:
--------------
    csw/mgar/gar/v2-fortran/lib/python/opencsw_test.py

Modified: csw/mgar/gar/v2-fortran/lib/python/opencsw_test.py
===================================================================
--- csw/mgar/gar/v2-fortran/lib/python/opencsw_test.py	2010-12-06 22:14:33 UTC (rev 11819)
+++ csw/mgar/gar/v2-fortran/lib/python/opencsw_test.py	2010-12-06 22:33:25 UTC (rev 11820)
@@ -163,6 +163,30 @@
     self.assertEqual("unspecified", parsed["osrel"])
 
 
+class ComposePackageFileNameUnitTest(unittest.TestCase):
+
+  def setUp(self):
+    self.parsed = {'arch': 'i386',
+                   'catalogname': 'mysql5client',
+                   'full_version_string': '5.0.87,REV=2010.02.28',
+                   'osrel': 'SunOS5.8',
+                   'revision_info': {'REV': '2010.02.28'},
+                   'vendortag': 'CSW',
+                   'version': '5.0.87',
+                   'version_info': {'major version': '5',
+                                    'minor version': '0',
+                                    'patchlevel': '87'}}
+
+  def testSimple(self):
+    file_name = 'mysql5client-5.0.87,REV=2010.02.28-SunOS5.8-i386-CSW.pkg'
+    self.assertEquals(file_name, opencsw.ComposePackageFileName(self.parsed))
+
+  def testMoreRev(self):
+    file_name = 'mysql5client-5.0.87,REV=2010.02.28_foo=bar-SunOS5.8-i386-CSW.pkg'
+    self.parsed["revision_info"]["foo"] = "bar"
+    self.assertEquals(file_name, opencsw.ComposePackageFileName(self.parsed))
+
+
 class ParseVersionStringTest(unittest.TestCase):
 
   def test_NoRev(self):
@@ -180,11 +204,28 @@
 
   def test_Empty(self):
     data = ""
-    opencsw.ParseVersionString(data)
     expected = ('', {'major version': ''}, {})
     self.assertEqual(expected, opencsw.ParseVersionString(data))
 
+  def testExtraStringsHashable(self):
+    data = "2.7,REV=2009.06.18_STABLE6"
+    expected = (
+        '2.7',
+        {
+          'minor version': '7',
+          'major version': '2'},
+        {
+          # Here's the important bit: all parts of the parsed version
+          # must be hashable for submitpkg to work.
+          'extra_strings': ('STABLE6',),
+          'REV': '2009.06.18',
+        }
+    )
+    result = opencsw.ParseVersionString(data)
+    hash(result[2]['extra_strings'])
+    self.assertEqual(expected, opencsw.ParseVersionString(data))
 
+
 class UpgradeTypeTest(unittest.TestCase):
 
   def testUpgradeType_1(self):


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