def test_log_background(argilla_user: User):
    """Verify that logs can be delayed via the background parameter."""
    dataset_name = "test_log_background"

    api = Argilla(api_key=argilla_user.api_key)
    api.delete(dataset_name)

    # Log in the background, and extract the future
    sample_text = "Sample text for testing"
    future = api.log(
        TextClassificationRecord(text=sample_text),
        name=dataset_name,
        background=True,
    )
    assert isinstance(future, concurrent.futures.Future)
    # Log the record to argilla
    try:
        future.result()
    finally:
        future.cancel()

    # The dataset now exists and holds one record
    dataset = api.load(dataset_name)
    assert len(dataset) == 1
    assert dataset[0].text == sample_text
Verify that logs can be delayed via the background parameter.
argilla-v1/tests/integration/client/test_api.py