Skip to content

test_search_date fails near date boundaries #3975

@smilerz

Description

@smilerz

Tandoor Version

2.0.2

Setup

Docker / Docker-Compose

Reverse Proxy

No reverse proxy

Other

No response

Bug description

Set a fixed reference datetime (e.g., reference_date = datetime(2025, 8, 28, 1, tzinfo=timezone.utc))
Create all recipes with explicit UTC datetimes relative to reference_date
Use the same reference for the query boundary
Example:

from datetime import datetime, timedelta, timezone
from freezegun import freeze_time


@pytest.fixture
def found_recipe(request, space_1, accent, unaccent, u1_s1, u2_s1):
    reference_date = datetime(2025, 8, 28, 0, 0, 0)


@freeze_time("2025-08-28 12:00:00", tz_offset=0)
def test_search_date(found_recipe, recipes, param_type, result, u1_s1, u2_s1, space_1):
    # force updated_at to equal created_at datetime
    with scope(space=space_1):
        for recipe in Recipe.objects.all():
            Recipe.objects.filter(id=recipe.id).update(updated_at=recipe.created_at)

    reference_date = datetime(2025, 8, 28, 0, 0, 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions