[csw-devel] SF.net SVN: gar:[8747] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Mon Feb 22 18:42:26 CET 2010
Revision: 8747
http://gar.svn.sourceforge.net/gar/?rev=8747&view=rev
Author: wahwah
Date: 2010-02-22 17:42:26 +0000 (Mon, 22 Feb 2010)
Log Message:
-----------
mGAR v2: checkpkg_test.py style cleanup, wrapping long lines
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/checkpkg.py
csw/mgar/gar/v2/lib/python/checkpkg_test.py
Modified: csw/mgar/gar/v2/lib/python/checkpkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg.py 2010-02-22 17:07:52 UTC (rev 8746)
+++ csw/mgar/gar/v2/lib/python/checkpkg.py 2010-02-22 17:42:26 UTC (rev 8747)
@@ -1090,7 +1090,8 @@
f = open(in_file_name_pickle, "r")
obj = cPickle.load(f)
f.close()
- logging.debug("ReadObject(): finished reading %s", repr(in_file_name_pickle))
+ logging.debug("ReadObject(): finished reading %s",
+ repr(in_file_name_pickle))
else:
logging.debug("ReadObject(): reading %s", repr(in_file_name))
f = open(in_file_name, "r")
Modified: csw/mgar/gar/v2/lib/python/checkpkg_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_test.py 2010-02-22 17:07:52 UTC (rev 8746)
+++ csw/mgar/gar/v2/lib/python/checkpkg_test.py 2010-02-22 17:42:26 UTC (rev 8747)
@@ -34,10 +34,19 @@
SELECT * FROM systempkgmap WHERE basename = 'libncursesw.so.5';
"""
+LDD_R_OUTPUT_1 = """\tlibc.so.1 => /lib/libc.so.1
+\tsymbol not found: check_encoding_conversion_args (/opt/csw/lib/postgresql/8.4/utf8_and_gbk.so)
+\tsymbol not found: LocalToUtf (/opt/csw/lib/postgresql/8.4/utf8_and_gbk.so)
+\tsymbol not found: UtfToLocal (/opt/csw/lib/postgresql/8.4/utf8_and_gbk.so)
+\tlibm.so.2 => /lib/libm.so.2
+"""
+
class DependenciesUnitTest_1(unittest.TestCase):
def setUp(self):
- self.missing_deps, self.surplus_deps, self.orphan_sonames = checkpkg.AnalyzeDependencies(
+ (self.missing_deps,
+ self.surplus_deps,
+ self.orphan_sonames) = checkpkg.AnalyzeDependencies(
d1.DATA_PKGNAME,
d1.DATA_DECLARED_DEPENDENCIES,
d1.DATA_BINARIES_BY_PKGNAME,
@@ -61,7 +70,9 @@
class DependenciesUnitTest_2(unittest.TestCase):
def setUp(self):
- self.missing_deps, self.surplus_deps, self.orphan_sonames = checkpkg.AnalyzeDependencies(
+ (self.missing_deps,
+ self.surplus_deps,
+ self.orphan_sonames) = checkpkg.AnalyzeDependencies(
d2.DATA_PKGNAME,
d2.DATA_DECLARED_DEPENDENCIES,
d2.DATA_BINARIES_BY_PKGNAME,
@@ -85,7 +96,9 @@
class DependenciesUnitTest_3(unittest.TestCase):
def setUp(self):
- self.missing_deps, self.surplus_deps, self.orphan_sonames = checkpkg.AnalyzeDependencies(
+ (self.missing_deps,
+ self.surplus_deps,
+ self.orphan_sonames) = checkpkg.AnalyzeDependencies(
d3.DATA_PKGNAME,
d3.DATA_DECLARED_DEPENDENCIES,
d3.DATA_BINARIES_BY_PKGNAME,
@@ -109,7 +122,9 @@
class DependenciesUnitTest_4(unittest.TestCase):
def setUp(self):
- self.missing_deps, self.surplus_deps, self.orphan_sonames = checkpkg.AnalyzeDependencies(
+ (self.missing_deps,
+ self.surplus_deps,
+ self.orphan_sonames) = checkpkg.AnalyzeDependencies(
d4.DATA_PKGNAME,
d4.DATA_DECLARED_DEPENDENCIES,
d4.DATA_BINARIES_BY_PKGNAME,
@@ -133,7 +148,9 @@
class DependenciesUnitTest_5(unittest.TestCase):
def setUp(self):
- self.missing_deps, self.surplus_deps, self.orphan_sonames = checkpkg.AnalyzeDependencies(
+ (self.missing_deps,
+ self.surplus_deps,
+ self.orphan_sonames) = checkpkg.AnalyzeDependencies(
d5.DATA_PKGNAME,
d5.DATA_DECLARED_DEPENDENCIES,
d5.DATA_BINARIES_BY_PKGNAME,
@@ -260,13 +277,15 @@
data1 = set(['CSWmysql51', 'CSWmysql51rt', 'CSWmysql51test',
'CSWmysql51client', 'CSWmysql51bench', 'CSWmysql51devel'])
data2 = dict(((x, x) for x in data1))
- self.assertEqual(set([u"CSWmysql51"]), checkpkg.GuessDepsByPkgname(u"CSWmysql51devel", data2))
+ self.assertEqual(set([u"CSWmysql51"]),
+ checkpkg.GuessDepsByPkgname(u"CSWmysql51devel", data2))
def testGuessDepsByPkgname4(self):
data1 = set(['CSWmysql51', 'CSWmysql51rt', 'CSWmysql51test',
'CSWmysql51client', 'CSWmysql51bench', 'CSWmysql51devel'])
data2 = dict(((x, x) for x in data1))
- self.assertEqual(set([]), checkpkg.GuessDepsByPkgname(u"CSWmysql51rt", data2))
+ self.assertEqual(set([]),
+ checkpkg.GuessDepsByPkgname(u"CSWmysql51rt", data2))
class GetLinesBySonameUnitTest(unittest.TestCase):
@@ -291,7 +310,8 @@
def testExpandRunpath_2(self):
isalist = ["foo", "bar"]
runpath = "/opt/csw/mysql5/lib/$ISALIST/mysql"
- expected = ["/opt/csw/mysql5/lib/foo/mysql", "/opt/csw/mysql5/lib/bar/mysql"]
+ expected = ["/opt/csw/mysql5/lib/foo/mysql",
+ "/opt/csw/mysql5/lib/bar/mysql"]
self.assertEquals(expected, checkpkg.ExpandRunpath(runpath, isalist))
def testEmulate64BitSymlinks_1(self):
@@ -329,8 +349,10 @@
expected = "/opt/csw/bdb42"
not_expected = "/opt/csw/bdb422"
result = checkpkg.Emulate64BitSymlinks(runpath_list)
- self.assertTrue(expected in result, "%s not in %s" % (expected, result))
- self.assertFalse(not_expected in result, "%s is in %s" % (not_expected, result))
+ self.assertTrue(expected in result,
+ "%s not in %s" % (expected, result))
+ self.assertFalse(not_expected in result,
+ "%s is in %s" % (not_expected, result))
def testEmulateSymlinks_5(self):
"""Install time symlink expansion."""
@@ -344,9 +366,12 @@
runpath_list = ["/opt/csw/lib/i386"]
expected = "/opt/csw/lib"
not_expected = "/opt/csw/lib/i386"
- result = checkpkg.ExpandSymlink("/opt/csw/lib/i386", "/opt/csw/lib", "/opt/csw/lib/i386")
+ result = checkpkg.ExpandSymlink("/opt/csw/lib/i386",
+ "/opt/csw/lib",
+ "/opt/csw/lib/i386")
self.assertTrue(expected in result, "%s not in %s" % (expected, result))
- self.assertFalse(not_expected in result, "%s is in %s" % (not_expected, result))
+ self.assertFalse(not_expected in result,
+ "%s is in %s" % (not_expected, result))
def testGetLinesBySoname(self):
expected = {'foo.so.1': '/opt/csw/lib/isa-value-1/foo.so.1 foo'}
@@ -438,8 +463,9 @@
def testGetLinesBySoname_6(self):
"""Based on CSWmysql5client on build8x."""
soname = u'libz.so.1'
- expected = {u'libz.so.1': u'/opt/csw/lib/pentium_pro+mmx/libz.so.1=libz.so.1.2.3 '
- u's none CSWzlib\n'}
+ expected = {
+ u'libz.so.1': u'/opt/csw/lib/pentium_pro+mmx/libz.so.1=libz.so.1.2.3 '
+ u's none CSWzlib\n'}
pkgmap_stub = self.PkgmapStub(d6.DATA_PKGMAP_CACHE)
(needed_sonames,
binaries_by_soname,
@@ -457,9 +483,9 @@
soname = u'libncursesw.so.5'
# To test the 64-bit symlink expansion
expected = {
- u'libncursesw.so.5':
- u'/opt/csw/lib/amd64/libncursesw.so.5=libncursesw.so.5.7 '
- u's none CSWncurses\n'}
+ u'libncursesw.so.5':
+ u'/opt/csw/lib/amd64/libncursesw.so.5=libncursesw.so.5.7 '
+ u's none CSWncurses\n'}
pkgmap_stub = self.PkgmapStub(d6.DATA_PKGMAP_CACHE)
(needed_sonames,
binaries_by_soname,
@@ -482,7 +508,8 @@
pkgmap.GetPkgmapLineByBasename("foo.so.1").AndReturn(lines1)
self.pkgmap_mocker.ReplayAll()
needed_sonames = set(["foo.so.1"])
- runpath_by_needed_soname = {"foo.so.1": ["/opt/csw/postgresql/lib/", "/usr/lib"]}
+ runpath_by_needed_soname = {
+ "foo.so.1": ["/opt/csw/postgresql/lib/", "/usr/lib"]}
isalist = ["isa-value-1", "isa-value-2"]
result = checkpkg.GetLinesBySoname(pkgmap, needed_sonames, runpath_by_needed_soname, isalist)
self.pkgmap_mocker.VerifyAll()
@@ -502,15 +529,18 @@
needed_sonames = set(["foo.so.0"])
runpath_by_needed_soname = {"foo.so.0": ["/opt/csw/lib", "/usr/lib"]}
isalist = ["isa-value-1", "isa-value-2"]
- result = checkpkg.GetLinesBySoname(pkgmap, needed_sonames, runpath_by_needed_soname, isalist)
+ result = checkpkg.GetLinesBySoname(
+ pkgmap, needed_sonames, runpath_by_needed_soname, isalist)
self.pkgmap_mocker.VerifyAll()
self.assertEqual(expected, result)
def testSanitizeRunpath_1(self):
- self.assertEqual("/opt/csw/lib", checkpkg.SanitizeRunpath("/opt/csw/lib/"))
+ self.assertEqual("/opt/csw/lib",
+ checkpkg.SanitizeRunpath("/opt/csw/lib/"))
def testSanitizeRunpath_2(self):
- self.assertEqual("/opt/csw/lib", checkpkg.SanitizeRunpath("/opt//csw////lib/"))
+ self.assertEqual("/opt/csw/lib",
+ checkpkg.SanitizeRunpath("/opt//csw////lib/"))
@@ -541,7 +571,8 @@
checkpkg.ParseDumpOutput(dump_1.DATA_DUMP_OUTPUT))
def test_2(self):
- expected_runpath = ['/usr/lib/$ISALIST', '/usr/lib', '/lib/$ISALIST', '/lib']
+ expected_runpath = ['/usr/lib/$ISALIST', '/usr/lib', '/lib/$ISALIST',
+ '/lib']
self.assertEqual(
expected_runpath,
checkpkg.ParseDumpOutput(dump_2.DATA_DUMP_OUTPUT)["runpath"])
@@ -623,11 +654,13 @@
def testParseTagLine3(self):
line = "CSWfoo: foo-tag foo-info"
- self.assertEquals(("CSWfoo", "foo-tag", "foo-info"), checkpkg.ParseTagLine(line))
+ self.assertEquals(("CSWfoo", "foo-tag", "foo-info"),
+ checkpkg.ParseTagLine(line))
def testParseTagLine4(self):
line = "CSWfoo: foo-tag foo-info1 foo-info2"
- self.assertEquals(("CSWfoo", "foo-tag", "foo-info1 foo-info2"), checkpkg.ParseTagLine(line))
+ self.assertEquals(("CSWfoo", "foo-tag", "foo-info1 foo-info2"),
+ checkpkg.ParseTagLine(line))
class ParseOverrideLineUnitTest(unittest.TestCase):
@@ -729,7 +762,7 @@
class PackageStatsUnitTest(unittest.TestCase):
- def test_ParseNmSymLine(self):
+ def test_ParseNmSymLineGoodLine(self):
line = '0000097616 T aliases_lookup'
expected = {
'address': '0000097616',
@@ -739,6 +772,11 @@
pkgstats = checkpkg.PackageStats(None)
self.assertEqual(expected, pkgstats._ParseNmSymLine(line))
+ def test_ParseNmSymLineBadLine(self):
+ line = 'foo'
+ pkgstats = checkpkg.PackageStats(None)
+ self.assertEqual(None, pkgstats._ParseNmSymLine(line))
+
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