def testTroveNames(self):
        for x in "12":
            for ver in "12":
                self.addComponent("trv%s:lib" % x, ver)
                self.addComponent("trv%s:runtime" % x, ver)
                self.addCollection("trv%s" % x, ver, [":lib", ":runtime"])
        repos = self.openRepository()
        ret = repos.troveNamesOnServer("localhost")
        self.assertEqual(set(ret),
                             set(['trv1:lib', 'trv1:runtime', 'trv1',
                                  'trv2:lib', 'trv2:runtime', 'trv2']))
        self.markRemoved("trv1=1") 
        ret = repos.troveNamesOnServer("localhost")
        self.assertEqual(set(ret),
                             set(['trv1:lib', 'trv1:runtime', 'trv1',
                                  'trv2:lib', 'trv2:runtime', 'trv2']))
        self.markRemoved("trv1=2") 
        ret = repos.troveNamesOnServer("localhost")
        self.assertEqual(set(ret), set(['trv2:lib', 'trv2:runtime', 'trv2']))

        self.addCollection("group-trv", [("trv2:runtime", "2"), ("trv3:runtime", "0")])
        ret = repos.troveNamesOnServer("localhost")
        # trv3:runtime is not present thus it shouldn't appear in the list
        self.assertEqual(set(ret), set(['trv2:lib', 'trv2:runtime', 'trv2', "group-trv"]))
        self.markRemoved("trv2=1")
        ret = repos.troveNamesOnServer("localhost")
        # trv2=2 is still there
        self.assertEqual(set(ret), set(['trv2:lib', 'trv2:runtime', 'trv2', "group-trv"]))
        self.markRemoved("trv2=2")
        ret = repos.troveNamesOnServer("localhost")
        self.assertEqual(set(ret), set(["group-trv"]))
        self.markRemoved("group-trv")
        ret = repos.troveNamesOnServer("localhost")
        self.assertEqual(set(ret), set())

        self.addCollection("group-other", ["foo:runtime", "foo:lib"])
        self.addComponent("foo:lib", "999")
        ret = repos.troveNamesOnServer("localhost")
        self.assertEqual(set(ret), set(["foo:lib", "group-other"]))
        self.markRemoved("foo:lib=999")
        ret = repos.troveNamesOnServer("localhost")
        self.assertEqual(set(ret), set(["group-other"]))
dataset/ETHPy150Open sassoftware/conary/conary_test/queryreptest.py/RepQueryTest.testTroveNames/original