def setup_artifact_cache(self, spec): """Subclasses can call this in their __init__() to set up artifact caching for that task type. spec should be a list of urls/file path prefixes, which are used in that order. By default, no artifact caching is used. """ if len(spec) > 0: pants_workdir = self.context.config.getdefault('pants_workdir') self._artifact_cache = create_artifact_cache(self.context, pants_workdir, spec)
def check(expected_type, spec): cache = create_artifact_cache(None, artifact_root, spec) assert isinstance(cache, expected_type) assert cache.artifact_root == artifact_root