[csw-devel] SF.net SVN: gar:[11489] csw/mgar/gar/v2/lib/python/package_checks_test.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Thu Nov 4 10:15:15 CET 2010


Revision: 11489
          http://gar.svn.sourceforge.net/gar/?rev=11489&view=rev
Author:   wahwah
Date:     2010-11-04 09:15:15 +0000 (Thu, 04 Nov 2010)

Log Message:
-----------
mGAR v2: checkpkg, *-devel packages should be allowed to depend on anything, a unit test.

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

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-11-03 16:18:46 UTC (rev 11488)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-11-04 09:15:15 UTC (rev 11489)
@@ -178,7 +178,8 @@
     self.pkg_data[0]["depends"].append(["CSWmarsian", "A package from Mars."])
     installed = ["CSWcommon", "CSWisaexec", "CSWiconv", "CSWlibpopt"]
     self.error_mgr_mock.GetInstalledPackages().AndReturn(installed)
-    self.error_mgr_mock.ReportError('CSWrsync', 'unidentified-dependency', 'CSWmarsian')
+    self.error_mgr_mock.ReportError(
+        'CSWrsync', 'unidentified-dependency', 'CSWmarsian')
 
 
 class TestSetCheckDependenciesGood(CheckpkgUnitTestHelper, unittest.TestCase):
@@ -214,7 +215,42 @@
     self.error_mgr_mock.GetInstalledPackages().AndReturn(installed)
 
 
-class TestCheckCheckDependsOnSelf(CheckpkgUnitTestHelper, unittest.TestCase):
+class TestSetCheckDependenciesDoNotReportSurplusForDevel(
+    CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'SetCheckLibraries'
+  def CheckpkgTest(self):
+    self.pkg_data_single = self.pkg_data
+    self.pkg_data = [self.pkg_data_single]
+    self.pkg_data[0]["basic_stats"]["pkgname"] = "CSWfoo-devel"
+    self.pkg_data[0]["depends"].append(["CSWfoo", ""])
+    self.pkg_data[0]["depends"].append(["CSWbar", ""])
+    self.pkg_data[0]["depends"].append(["CSWlibiconv", ""])
+    # Mocking out the interaction with the database
+    self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libc.so.1').AndReturn({
+      "/usr/lib": (u"SUNWcsl",)})
+    self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libiconv.so.2').AndReturn({
+      "/opt/csw/lib": (u"CSWlibiconv",)})
+    self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libnsl.so.1').AndReturn({
+      "/usr/lib": (u"SUNWcsl",),
+      "/usr/lib/sparcv9": (u"SUNWcslx"),})
+    self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libpopt.so.0').AndReturn({
+      "/opt/csw/lib": (u"CSWlibpopt",)})
+    self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libsec.so.1').AndReturn({
+      "/usr/lib": (u"SUNWfoo",),
+      "/usr/lib/sparcv9": (u"SUNWfoo"),})
+    self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libsocket.so.1').AndReturn({
+      "/usr/lib": (u"SUNWcsl",),
+      "/usr/lib/sparcv9": (u"SUNWcslx"),})
+    common_path_pkgs = [u'CSWgdbm', u'CSWbinutils', u'CSWcommon']
+    paths_to_check = [
+        '/opt/csw/share/man', '/opt/csw/bin', '/opt/csw/bin/sparcv8',
+        '/opt/csw/bin/sparcv9', '/opt/csw/share/doc']
+    for pth in paths_to_check:
+      self.error_mgr_mock.GetPkgByPath(pth).AndReturn(common_path_pkgs)
+    # There should be no error about the dependency on CSWfoo or CSWbar.
+
+
+class TestCheckDependsOnSelf(CheckpkgUnitTestHelper, unittest.TestCase):
   FUNCTION_NAME = 'CheckDependsOnSelf'
   def CheckpkgTest(self):
     self.pkg_data["depends"].append(["CSWrsync", ""])
@@ -627,6 +663,7 @@
         'isalist': (),
         'pkgmap': [],
       }
+
   def CheckpkgTest(self):
     self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libfoo.so.1').AndReturn({
        u'/opt/csw/lib': [u'CSWlibfoo'],
@@ -1099,8 +1136,7 @@
     })
     self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libsocket.so.1').AndReturn({
       "/usr/lib": (u"SUNWcsl",),
-      "/usr/lib/sparcv9": (u"SUNWcslx"),
-    })
+      "/usr/lib/sparcv9": (u"SUNWcslx"),})
     common_path_pkgs = [u'CSWgdbm', u'CSWbinutils', u'CSWcommon']
     paths_to_check = [
         '/opt/csw/share/man', '/opt/csw/bin', '/opt/csw/share', '/var/opt/csw',
@@ -1149,9 +1185,12 @@
     for path in paths_to_check:
       self.error_mgr_mock.GetPkgByPath(path).AndReturn(common_path_pkgs)
     # This is the critical test here.
-    self.error_mgr_mock.ReportError('CSWsudo-common', 'base-dir-not-found', '/opt/csw/share/man')
-    self.error_mgr_mock.ReportError('CSWsudo', 'surplus-dependency', 'CSWalternatives')
-    self.error_mgr_mock.ReportError('CSWsudo', 'surplus-dependency', 'CSWsudo-common')
+    self.error_mgr_mock.ReportError(
+        'CSWsudo-common', 'base-dir-not-found', '/opt/csw/share/man')
+    self.error_mgr_mock.ReportError(
+        'CSWsudo', 'surplus-dependency', 'CSWalternatives')
+    self.error_mgr_mock.ReportError(
+        'CSWsudo', 'surplus-dependency', 'CSWsudo-common')
 
 
 class TestSetCheckDoubleDepends(CheckpkgUnitTestHelper, unittest.TestCase):


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