

def testFileUpdateMissingKey(self):
    fingerprint = '95B457D16843B21EA3FC73BBC7C32FC1F94E405E'
    cs = changeset.ChangeSet()
    flavor = deps.parseFlavor('')
    v = versions.VersionFromString(('/%s/1.0-1-1' % self.cfg.buildLabel.asString())).copy()
    v.resetTimeStamps()
    t = trove.Trove('test:test', v, flavor, None)
    path = (self.workDir + '/blah')
    f = open(path, 'w')
    f.write('hello, world!\n')
    f.close()
    pathId = sha1helper.md5String('/blah')
    f = files.FileFromFilesystem(path, pathId)
    fileId = f.fileId()
    t.addFile(pathId, '/blah', v, fileId)
    cs.addFile(None, fileId, csPath.freeze())
    cs.addFileContents(pathId, fileId, changeset.ChangedFileTypes.file, filecontents.FromFilesystem(path), f.flags.isConfig())
    diff = t.diff(None, absolute=1)[0]
    cs.newTrove(diff)
    cs.addPrimaryTrove('test:test', v, flavor)
    csPath = os.path.join(self.workDir, 'test-1.0-1.ccs')
    cs = cook.signAbsoluteChangeset(cs, fingerprint)
    cs.writeToFile(csPath)
    tmpPath = mkdtemp()
    keyCache = openpgpkey.getKeyCache()
    newKeyCache = openpgpkey.OpenPGPKeyFileCache()
    pubRing = self.cfg.pubRing
    self.cfg.pubRing = [(tmpPath + '/pubring.gpg')]
    keyCacheCallback = openpgpkey.KeyCacheCallback(None, self.cfg)
    newKeyCache.setCallback(keyCacheCallback)
    openpgpkey.setKeyCache(newKeyCache)
    try:
        self.updatePkg(self.rootDir, csPath)
    finally:
        self.cfg.pubRing = pubRing
        openpgpkey.setKeyCache(keyCache)

dataset/ETHPy150Open sassoftware/conary/conary_test/cvctest/sigtest.py SigTest.testFileUpdateMissingKey/VarMisuse@158/248 `f`->`csPath`