SF.net SVN: gar:[23110] csw/mgar/gar/v2/lib/python

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Mar 2 22:24:46 CET 2014


Revision: 23110
          http://sourceforge.net/p/gar/code/23110
Author:   wahwah
Date:     2014-03-02 21:24:45 +0000 (Sun, 02 Mar 2014)
Log Message:
-----------
checkpkg: Enabled unit tests for license paths

And that the catalogname matches pkgname.

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

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2014-03-02 17:52:39 UTC (rev 23109)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2014-03-02 21:24:45 UTC (rev 23110)
@@ -434,9 +434,6 @@
       if file_path in self.pkgs_by_file:
         for pkg in self.pkgs_by_file[file_path]:
           pkgs.add(pkg)
-      # logging_response = pprint.pformat(pkgs)
-      # logging.debug("GetPkgByPath(%s).AndReturn(%s)"
-      #               % (file_path, logging_response))
       self.pkgs_by_path_cache[key] = pkgs
     return self.pkgs_by_path_cache[key]
 

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2014-03-02 17:52:39 UTC (rev 23109)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2014-03-02 21:24:45 UTC (rev 23110)
@@ -10,9 +10,9 @@
 
 import copy
 import datetime
+import logging
+import mox
 import os.path
-import mox
-import logging
 import pprint
 
 from lib.python.testdata.djvulibre_rt_stats import pkgstats as djvulibre_rt_stats
@@ -2600,40 +2600,31 @@
 #         'soname=libneon.so.27 filename=foo.so.1')
 
 
-# class TestCheckLicenseFilePlacementLicense(CheckTestHelper,
-#                                            unittest.TestCase):
-#   FUNCTION_NAME = 'CheckLicenseFilePlacement'
-#   def testBadLicensePlacement(self):
-#     self.pkg_data = copy.deepcopy(neon_stats[0])
-#     self.pkg_data["pkgmap"].append({
-#       "class": "none", "type": "f", "line": "",
-#       "user": "root", "group": "bin", "mode": '0755',
-#       "path": "/opt/csw/share/doc/alien/license",
-#     })
-#     self.error_mgr_mock.ReportError(
-#         'wrong-docdir',
-#         'expected=/opt/csw/shared/doc/neon/... '
-#         'in-package=/opt/csw/share/doc/alien/license')
-# 
-#   def testGoodRandomFileWithSuffix(self):
-#     """A differently suffixed file should not trigger an error."""
-#     self.pkg_data = copy.deepcopy(neon_stats[0])
-#     self.pkg_data["pkgmap"].append({
-#       "class": "none", "type": "f", "line": "",
-#       "user": "root", "group": "bin", "mode": '0755',
-#       "path": "/opt/csw/share/doc/alien/license.html",
-#     })
-# 
-#   def testGoodRandomFile(self):
-#     "A random file should not trigger the message; only license files."
-#     self.pkg_data = copy.deepcopy(neon_stats[0])
-#     self.pkg_data["pkgmap"].append({
-#       "class": "none", "type": "f", "line": "",
-#       "user": "root", "group": "bin", "mode": '0755',
-#       "path": "/opt/csw/share/doc/alien/random_file",
-#     })
+class TestCheckLicenseFilePlacementLicense(CheckTestHelper,
+                                           unittest.TestCase):
+  FUNCTION_NAME = 'CheckLicenseFilePlacement'
+  def testBadLicensePlacement(self):
+    self.pkg_data = copy.deepcopy(neon_stats[0])
+    self.pkg_data["pkgmap"].append(
+        self.TestPkgmapEntry("/opt/csw/share/doc/alien/license"))
+    self.error_mgr_mock.ReportError(
+        'wrong-docdir',
+        'expected=/opt/csw/shared/doc/neon/... '
+        'in-package=/opt/csw/share/doc/alien/license')
 
+  def testGoodRandomFileWithSuffix(self):
+    """A differently suffixed file should not trigger an error."""
+    self.pkg_data = copy.deepcopy(neon_stats[0])
+    self.pkg_data["pkgmap"].append(
+        self.TestPkgmapEntry("/opt/csw/share/doc/alien/license.html"))
 
+  def testGoodRandomFile(self):
+    "A random file should not trigger the message; only license files."
+    self.pkg_data = copy.deepcopy(neon_stats[0])
+    self.pkg_data["pkgmap"].append(
+        self.TestPkgmapEntry("/opt/csw/share/doc/alien/random_file"))
+
+
 class TestCheckObsoleteDepsCups(CheckTestHelper, unittest.TestCase):
   "A random file should not trigger the message; only license files."
   FUNCTION_NAME = 'CheckObsoleteDeps'
@@ -2790,45 +2781,45 @@
 #     self.pkg_data = mercurial_stats[0]
 
 
-# class TestCheckCatalognameMatchesPkgname(CheckTestHelper,
-#                                          unittest.TestCase):
-#   FUNCTION_NAME = 'CheckCatalognameMatchesPkgname'
-# 
-#   def testMismatch(self):
-#     self.pkg_data = copy.deepcopy(tree_stats[0])
-#     basic_stats = self.pkg_data["basic_stats"]
-#     basic_stats["catalogname"] = "foo_bar"
-#     basic_stats["pkgname"] = "CSWfoo-bar-baz"
-#     self.error_mgr_mock.ReportError(
-#         'catalogname-does-not-match-pkgname',
-#         'pkgname=CSWfoo-bar-baz catalogname=foo_bar '
-#         'expected-catalogname=foo_bar_baz')
-# 
-#   def testGoodMatch(self):
-#     self.pkg_data = copy.deepcopy(tree_stats[0])
+class TestCheckCatalognameMatchesPkgname(CheckTestHelper,
+                                         unittest.TestCase):
+  FUNCTION_NAME = 'CheckCatalognameMatchesPkgname'
 
+  def testMismatch(self):
+    self.pkg_data = copy.deepcopy(tree_stats[0])
+    basic_stats = self.pkg_data["basic_stats"]
+    basic_stats["catalogname"] = "foo_bar"
+    basic_stats["pkgname"] = "CSWfoo-bar-baz"
+    self.error_mgr_mock.ReportError(
+        'catalogname-does-not-match-pkgname',
+        'pkgname=CSWfoo-bar-baz catalogname=foo_bar '
+        'expected-catalogname=foo_bar_baz')
 
-# class TestCheckCatalognameMatchesPkgname(CheckTestHelper,
-#                                          unittest.TestCase):
-#   FUNCTION_NAME = 'CheckPkginfoOpencswRepository'
-# 
-#   def testRepositoryInfoGood(self):
-#     self.pkg_data = copy.deepcopy(tree_stats[0])
-#     # No errors reported.
-# 
-#   def testRepositoryInfoMissing(self):
-#     self.pkg_data = copy.deepcopy(tree_stats[0])
-#     del self.pkg_data["pkginfo"]["OPENCSW_REPOSITORY"]
-#     self.error_mgr_mock.ReportError('pkginfo-opencsw-repository-missing')
-# 
-#   def testRepositoryInfoUncommitted(self):
-#     self.pkg_data = copy.deepcopy(tree_stats[0])
-#     self.pkg_data["pkginfo"]["OPENCSW_REPOSITORY"] = (
-#         "https://gar.svn.sourceforge.net/svnroot/gar/"
-#         "csw/mgar/pkg/puppet/trunk at UNCOMMITTED")
-#     self.error_mgr_mock.ReportError('pkginfo-opencsw-repository-uncommitted')
-# 
-# 
+  def testGoodMatch(self):
+    self.pkg_data = copy.deepcopy(tree_stats[0])
+
+
+class TestCheckCatalognameMatchesPkgname(CheckTestHelper,
+                                         unittest.TestCase):
+  FUNCTION_NAME = 'CheckPkginfoOpencswRepository'
+
+  def testRepositoryInfoGood(self):
+    self.pkg_data = copy.deepcopy(tree_stats[0])
+    # No errors reported.
+
+  def testRepositoryInfoMissing(self):
+    self.pkg_data = copy.deepcopy(tree_stats[0])
+    del self.pkg_data["pkginfo"]["OPENCSW_REPOSITORY"]
+    self.error_mgr_mock.ReportError('pkginfo-opencsw-repository-missing')
+
+  def testRepositoryInfoUncommitted(self):
+    self.pkg_data = copy.deepcopy(tree_stats[0])
+    self.pkg_data["pkginfo"]["OPENCSW_REPOSITORY"] = (
+        "https://gar.svn.sourceforge.net/svnroot/gar/"
+        "csw/mgar/pkg/puppet/trunk at UNCOMMITTED")
+    self.error_mgr_mock.ReportError('pkginfo-opencsw-repository-uncommitted')
+
+
 # class TestCheckAlternativesDependency(CheckTestHelper, unittest.TestCase):
 #   FUNCTION_NAME = 'CheckAlternativesDependency'
 #   ALTERNATIVES_EXECUTABLE = "/opt/csw/sbin/alternatives"

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