[csw-devel] SF.net SVN: gar:[8731] csw/mgar/gar/v2/lib/python/package_checks.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Mon Feb 22 12:17:26 CET 2010
Revision: 8731
http://gar.svn.sourceforge.net/gar/?rev=8731&view=rev
Author: wahwah
Date: 2010-02-22 11:17:26 +0000 (Mon, 22 Feb 2010)
Log Message:
-----------
mGAR v2: checkpkg, more comments and future ideas.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/package_checks.py
Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py 2010-02-22 10:53:53 UTC (rev 8730)
+++ csw/mgar/gar/v2/lib/python/package_checks.py 2010-02-22 11:17:26 UTC (rev 8731)
@@ -46,13 +46,30 @@
# pkg.catalogname.lower(),
# pkg,
# "catalogname-not-lowercase")
+#
+# A question: What would unit tests of these checks look like?
#
# Alternately, a function-based approach is possible:
#
-# def IndividualCheckCatalogname(pkg_data, checkpkg_mgr):
-# catalogdata = pkg_data["basic_stats"]["catalogname"]
-# if catalogdata != catalogdata.lower():
+# def IndividualCheckCatalogname(pkg_data, checkpkg_mgr, debug):
+# catalogname = pkg_data["basic_stats"]["catalogname"]
+# if catalogname != catalogname.lower():
# checkpkg_mgr.ReportError("catalogname-not-lowercase")
+#
+# Here, unit testing of these functions would always require mock objects. But
+# overall it looks like a simpler approach.
+#
+# Instead of the debug flag, a logger could be used, although it would make
+# testing slightly annoying, since it would be necessary to mock
+# all the calls to the logger.
+#
+# def IndividualCheckCatalogname(pkg_data, checkpkg_mgr, logger):
+# catalogname = pkg_data["basic_stats"]["catalogname"]
+# logger.debug("catalogname: %s", catalogname)
+# if catalogname != catalogname.lower():
+# checkpkg_mgr.ReportError("catalogname-not-lowercase")
+#
+#
import checkpkg
import re
@@ -120,6 +137,3 @@
print ("However, be aware that there might be other reasons "
"to keep it architecture-specific.")
return errors
-
-
-
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