def testFindTrovesWithFlavorPreferences4(self):
        repos = self.openRepository()
        db = self.openDatabase()
        Flavor = deps.parseFlavor
        def _find(spec, getLeaves=True, bestFlavor=True):
            cfg = self.cfg
            spec = cmdline.parseTroveSpec(spec)
            tupList = repos.findTrove(cfg.installLabelPath, spec, cfg.flavor,
                                      affinityDatabase=db, getLeaves=getLeaves,
                                      bestFlavor=bestFlavor)
            tupList = sorted([('%s=%s[%s]' % (x[0],
                                          x[1].trailingRevision().getVersion(),
                                          x[2])) for x in tupList ])
            return tupList

        repos.setFlavorPreferenceList([Flavor('is: x86_64'), Flavor('is:x86')])
        self.cfg.flavor = [Flavor('is:x86(~sse,~sse2) x86_64')]

        self.addComponent('foo:run=1[is:x86(sse,sse2)]')
        self.addComponent('foo:run=1[is:x86 x86_64]')
        self.addComponent('foo:run=2[is:x86(sse,sse2)]')
        self.addComponent('foo:run=2[is:x86 x86_64]')
        self.addComponent('foo:run=3[is:x86(sse,sse2)]')
        self.addComponent('foo:run=3[is:x86 x86_64]')
        #   get the best flavor for each version.
        expectedResults = ['foo:run=1[is: x86 x86_64]',
                          'foo:run=2[is: x86 x86_64]',
                          'foo:run=3[is: x86 x86_64]']
        try:
            results = _find('foo:run', getLeaves=False)
            assert(results == expectedResults)
        except __HOLE__:
           print "\nexpected: ['%s']" % "', '".join(expectedResults) 
           print "got ['%s']" % "', '".join(results)
           raise
dataset/ETHPy150Open sassoftware/conary/conary_test/repositorytest/findtrovetest.py/FindTroveTest.testFindTrovesWithFlavorPreferences4