def test_internal_symlinks_only(self):
        """
        The resulting ``virtualenv`` only contains symlinks to files inside the
        virtualenv and to /usr on the host OS.
        """
        target_path = FilePath(self.mktemp())
        create_virtualenv(root=target_path)
        allowed_targets = (target_path, FilePath('/usr'),)
        bad_links = []
        for path in target_path.walk():
            if path.islink():
                realpath = path.realpath()
                for allowed_target in allowed_targets:
                    try:
                        realpath.segmentsFrom(allowed_target)
                    except __HOLE__:
                        pass
                    else:
                        # The target is a descendent of an allowed_target.
                        break
                else:
                    bad_links.append(path)
        if bad_links:
            self.fail(
                "Symlinks outside of virtualenv detected:" +
                '\n'.join(
                    '/'.join(
                        path.segmentsFrom(target_path)
                    ) + ' -> ' + path.realpath().path
                    for path in bad_links
                )
            )
dataset/ETHPy150Open ClusterHQ/flocker/admin/test/test_packaging.py/CreateVirtualenvTests.test_internal_symlinks_only