コード例 #1
0
 def testRegen(self):
     ps = ProductStack.fromCache(self.dbpath, "Linux", autosave=True, 
                                 updateCache=True, verbose=False)
     self.assert_(not ps.hasProduct("afw"))
     prod = Product("afw", "1.2", "Darwin", "/opt/sw/Darwin/afw/1.2", "none")
     ps.addProduct(prod)
     ps.reload("Linux")
     self.assert_(ps.hasProduct("afw"))
     del ps
     ps = ProductStack.fromCache(self.dbpath, "Linux", autosave=False, 
                                 updateCache=True, verbose=False)
     self.assert_(not ps.hasProduct("afw"))
コード例 #2
0
    def testDetectOutOfSync(self):
        ps1 = ProductStack.fromCache(self.dbpath, "Linux", autosave=False, 
                                     updateCache=True, verbose=1)
        ps2 = ProductStack.fromCache(self.dbpath, "Linux", autosave=False, 
                                     updateCache=True, verbose=1)
        time.sleep(1)
        ps1.addProduct(Product("fw", "1.2", "Linux", 
                               "/opt/sw/Darwin/fw/1.2", "none"))
        self.assert_(ps1.cacheIsInSync())
        ps1.save()
        self.assert_(ps1.cacheIsInSync())

        self.assert_(not ps2.cacheIsInSync())
        ps2.addProduct(Product("fw", "1.2", "Linux", 
                               "/opt/sw/Darwin/fw/1.2", "none"))
        self.assertRaises(CacheOutOfSync, ps2.save)