def METHOD_NAME(tmpdir, datafiles):
    project_dir = str(datafiles)
    # Set up an artifact cache.
    artifactshare = os.path.join(str(tmpdir), "artifactshare")
    with create_artifact_share(artifactshare) as share:
        # Configure artifact share
        rootcache_dir = os.path.join(str(tmpdir), "cache")
        user_config_file = str(tmpdir.join("buildstream.conf"))
        user_config = {
            "scheduler": {"pushers": 1},
            "artifacts": {
                "servers": [
                    {
                        "url": share.repo,
                        "push": True,
                    }
                ]
            },
            "cachedir": rootcache_dir,
        }
        # Write down the user configuration file
        _yaml.roundtrip_dump(user_config, file=user_config_file)
        with dummy_context(config=user_config_file) as context:
            # Load the project manually
            project = Project(project_dir, context)
            project.ensure_fully_loaded()
            # Create a local artifact cache handle
            artifactcache = context.artifactcache
            # Initialize remotes
            context.initialize_remotes(True, True, None, None)
            assert artifactcache.has_push_remotes()
            command = remote_execution_pb2.Command(
                arguments=["/usr/bin/gcc", "--help"],
                working_directory="/buildstream-build",
                output_directories=["/buildstream-install"],
            )
            # Push the message object
            _, remotes = artifactcache.get_remotes(project.name, True)
            assert len(remotes) == 1
            command_digest = remotes[0].push_message(command)
            message_hash, message_size = command_digest.hash, command_digest.size_bytes
        assert message_hash and message_size
        message_digest = remote_execution_pb2.Digest(hash=message_hash, size_bytes=message_size)
        assert share.has_object(message_digest)