def METHOD_NAME(cli, tmpdir, datafiles, with_project):
    project = str(datafiles)
    element = "target.bst"
    result = cli.run(project=project, args=["build", element])
    result.assert_success()
    cache_key = cli.get_element_key(project, element)
    artifact_ref = "test/target/" + cache_key
    # Delete the project.conf if we're going to try this without a project
    if not with_project:
        os.remove(os.path.join(project, "project.conf"))
    result = cli.run(project=project, args=["artifact", "show", artifact_ref])
    result.assert_success()
    assert "cached {}".format(artifact_ref) in result.output