@conary_test.rpm
    def testRemoveCapsuleFiles(self):
        """
        Ensure that the remove capsule files policy actually works. Make
        sure removed files don't leave behind file provides.
        """

        recipe1 = """\
class TestRecipe(CapsuleRecipe):
    name = 'test'
    version = '0'

    clearBuildReqs()

    def setup(r):
        r.addCapsule('shareddirs-1.0-1.x86_64.rpm', dir='/',
            package='%(name)s:rpm')
"""


        recipe2 = (recipe1 + "\n        "
            "r.RemoveCapsuleFiles('%(name)s:rpm', '^/usr/bin/script$')")

        trv = self.build(recipe1, 'TestRecipe')
        files1 = [ x[1] for x in trv.iterFileList() ]
        self.assertTrue('/usr/bin/script' in files1)
        assert(trv.provides.getDepClasses()[deps.DEP_CLASS_FILES].hasDep('/usr/bin/script'))

        trv2 = self.build(recipe2, 'TestRecipe')
        files2 = [ x[1] for x in trv2.iterFileList() ]
        self.assertTrue('/usr/bin/script' not in files2)
        assert(deps.DEP_CLASS_FILES not in trv2.provides.getDepClasses())

        recipe3 = (recipe1 + "\n        "
            "r.RemoveCapsuleFiles('%(name)s:foo', '^/usr/bin/script$')")
        e = self.assertRaises(PolicyError, self.build, recipe3, 'TestRecipe')
        self.assertEquals(str(e),
                  'Package Policy errors found:\n'
                  'RemoveCapsuleFiles: Component test:foo does not exist')
dataset/ETHPy150Open sassoftware/conary/conary_test/cvctest/buildtest/capsulepolicytest.py/RpmCapsuleTest.testRemoveCapsuleFiles/original