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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Mar 25 19:45:42 CEST 2012


Revision: 17546
          http://gar.svn.sourceforge.net/gar/?rev=17546&view=rev
Author:   wahwah
Date:     2012-03-25 17:45:42 +0000 (Sun, 25 Mar 2012)
Log Message:
-----------
checkpkg: ListBinaries unit test fix

It's necessary to mock out the os.access function.

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

Modified: csw/mgar/gar/v2/lib/python/inspective_package_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package_test.py	2012-03-25 17:40:49 UTC (rev 17545)
+++ csw/mgar/gar/v2/lib/python/inspective_package_test.py	2012-03-25 17:45:42 UTC (rev 17546)
@@ -21,12 +21,14 @@
 
 class InspectivePackageUnitTest(mox.MoxTestBase):
 
-  def testInstantiate(self):
+  def testListBinaries(self):
     self.mox.StubOutWithMock(hachoir_parser, 'createParser',
         use_mock_anything=True)
     hachoir_parser_mock = self.mox.CreateMockAnything()
     hachoir_parser.createParser(
         u'/fake/path/CSWfoo/root/foo-file').AndReturn(hachoir_parser_mock)
+    self.mox.StubOutWithMock(os, 'access')
+    os.access(u'/fake/path/CSWfoo/root/foo-file', os.R_OK).AndReturn(True)
     machine_mock = self.mox.CreateMockAnything()
     machine_mock.value = 2
     hachoir_parser_mock.__getitem__('/header/machine').AndReturn(machine_mock)
@@ -64,7 +66,7 @@
     ip.pkginfo_dict = {
         "BASEDIR": "",
     }
-    self.assertEqual(["foo-file"], ip.ListBinaries())
+    self.assertEqual([u'/fake/path/CSWfoo/root/foo-file'], ip.ListBinaries())
 
 
 class PackageStatsUnitTest(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