Ejemplo n.º 1
0
 def test_secHash_consistent(self):
     """Tests that secHashFile of a pickled object is the same as secHashObject of the object."""
     l = [1, 2, 3]
     d = dict()
     d['a'] = l
     d['b'] = l
     with TempDir() as tempDir:
         def loc(suffix):
             return os.path.join(tempDir.location, suffix)
         persist.savePickle(loc('d.pickle'), d)
         assert (persist.secHashFile(loc('d.pickle')) ==
                 persist.secHashObject(d))
Ejemplo n.º 2
0
 def test_pickling(self):
     l = [1, 2, 3]
     d = dict()
     d['a'] = l
     d['b'] = l
     with TempDir() as tempDir:
         def loc(suffix):
             return os.path.join(tempDir.location, suffix)
         location1 = loc('d1.pickle')
         location2 = loc('d2.pickle')
         persist.savePickle(location1, d)
         persist.savePickle(location2, d)
         dAgain1 = persist.loadPickle(location1)
         dAgain2 = persist.loadPickle(location2)
         assert d == dAgain1 == dAgain2
Ejemplo n.º 3
0
    def createLiveJob(self, job, queuer):
        jobSecHash = job.secHash()
        jobQueuerDir = self.getJobQueuerDir(job, queuer)
        createDir(jobQueuerDir)
        liveJobDir = tempfile.mkdtemp(prefix = 'liveJob.', dir = jobQueuerDir)
        liveJob = LiveJob(liveJobDir)
        persist.savePickle(os.path.join(liveJob.dir, 'job.pickle'), job)
        liveJob.setExtra('secHash', jobSecHash)
        persist.savePickle(os.path.join(liveJob.dir, 'buildRepo.pickle'), self)
        liveJob.setStored()

        job.checkAllSecHash()
        assert self.getJobQueuerDir(job, queuer) == jobQueuerDir
        jobAgain = persist.loadPickle(os.path.join(liveJob.dir, 'job.pickle'))
        job.checkAllSecHash()

        return liveJob
Ejemplo n.º 4
0
 def saveValue(self, buildRepo, value):
     return persist.savePickle(self.loc(buildRepo), value)
Ejemplo n.º 5
0
 def saveValue(self, buildRepo, value):
     return persist.savePickle(self.loc(buildRepo), value)