def METHOD_NAME(tmpdir, cli, datafiles):
    project_dir = os.path.join(datafiles, "project")
    cachedir = os.path.join(str(tmpdir), "cache")
    cli.configure({"cachedir": cachedir})
    res = cli.run(project=project_dir, args=["build", "import-bin.bst"])
    res.assert_success()
    with dummy_context() as context:
        context.cachedir = cachedir
        # load project and sourcecache
        project = Project(project_dir, context)
        project.ensure_fully_loaded()
        sourcecache = context.sourcecache
        cas = context.get_cascache()
        # now check that the source is in the refs file, this is pretty messy but
        # seems to be the only way to get the sources?
        element = project.load_elements(["import-bin.bst"])[0]
        element._query_source_cache()
        source = list(element.sources())[0]
        assert element._cached_sources()
        assert sourcecache.contains(source)
        # Extract the file and check it's the same as the one we imported
        digest = sourcecache.export(source)._get_digest()
        extractdir = os.path.join(str(tmpdir), "extract")
        cas.checkout(extractdir, digest)
        dir1 = extractdir
        dir2 = os.path.join(project_dir, "files", "bin-files")
        assert list(relative_walk(dir1)) == list(relative_walk(dir2))