Skip to content

Flaky test: test_pagination_queries #692

Open
@abrookins

Description

@abrookins

This test has been flaking:

=================================== FAILURES ===================================
___________________________ test_pagination_queries ____________________________
[gw2] linux -- Python 3.12.10 /home/runner/work/redis-om-python/redis-om-python/.venv/bin/python

members = (Member(id=0, first_name='Andrew', last_name='Brookins', email='a@example.com', join_date=datetime.date(2025, 4, 30), ...com', join_date=datetime.date(2025, 4, 30), age=100, bio='This is member 3 who is a funny and lively sort of person.'))
m = Models(BaseHashModel=<class 'tests.test_hash_model.m.<locals>.BaseHashModel'>, Order=<class 'tests.test_hash_model.m.<locals>.Order'>, Member=<class 'tests.test_hash_model.m.<locals>.Member'>)

    @py_test_mark_asyncio
    async def test_pagination_queries(members, m):
        member1, member2, member3 = members
    
        actual = await m.Member.find(m.Member.last_name == "Brookins").page()
    
>       assert actual == [member1, member2]
E       AssertionError: assert [Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.'), Member(id=0, first_name='Andrew', last_name='Brookins', email='a@example.com', join_date=datetime.date(2025, 4, 30), age=38, bio='This is member 1 whose greatness makes him the life and soul of any party he goes to.')] == [Member(id=0, first_name='Andrew', last_name='Brookins', email='a@example.com', join_date=datetime.date(2025, 4, 30), age=38, bio='This is member 1 whose greatness makes him the life and soul of any party he goes to.'), Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.')]
E         
E         At index 0 diff: Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.') != Member(id=0, first_name='Andrew', last_name='Brookins', email='a@example.com', join_date=datetime.date(2025, 4, 30), age=38, bio='This is member 1 whose greatness makes him the life and soul of any party he goes to.')
E         
E         Full diff:
E           [
E         +     Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.'),
E               Member(id=0, first_name='Andrew', last_name='Brookins', email='a@example.com', join_date=datetime.date(2025, 4, 30), age=38, bio='This is member 1 whose greatness makes him the life and soul of any party he goes to.'),
E         -     Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.'),
E           ]

tests/test_hash_model.py:185: AssertionError
------------------------------ Captured log setup ------------------------------
WARNING  aredis_om.model.model:model.py:1387 Field is marked as index=False, but it is a vector, full text search, or sortable field. This will be ignored and the field will be indexed.
WARNING  aredis_om.model.model:model.py:1387 Field is marked as index=False, but it is a vector, full text search, or sortable field. This will be ignored and the field will be indexed.
=============================== warnings summary ===============================
tests/test_hash_model.py::test_delete_many
tests/test_hash_model.py::test_sorting
tests/test_find_query.py::test_find_query_text_contains
tests/test_find_query.py::test_find_query_in
  /home/runner/work/redis-om-python/redis-om-python/.venv/lib/python3.12/site-packages/pytest_asyncio/plugin.py:783: DeprecationWarning: The event_loop fixture provided by pytest-asyncio has been redefined in
  /home/runner/work/redis-om-python/redis-om-python/tests/conftest.py:20
  Replacing the event_loop fixture with a custom implementation is deprecated
  and will lead to errors in the future.
  If you want to request an asyncio event loop with a scope other than function
  scope, use the "scope" argument to the asyncio mark when marking the tests.
  If you want to return different types of event loops, use the event_loop_policy
  fixture.
  
    warnings.warn(

tests/test_json_model.py::test_model_with_dict
tests_sync/test_json_model.py::test_model_with_dict
  /home/runner/work/redis-om-python/redis-om-python/.venv/lib/python3.12/site-packages/pydantic/_internal/_fields.py:192: UserWarning: Field name "dict" in "test_model_with_dict.<locals>.EmbeddedJsonModelWithDict" shadows an attribute in parent "EmbeddedJsonModel"
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform linux, python 3.12.10-final-0 ----------
Name                                     Stmts   Miss  Cover   Missing
----------------------------------------------------------------------
aredis_om/__init__.py                        5      0   100%
aredis_om/async_redis.py                     1      0   100%
aredis_om/checks.py                         20     12    40%   8-9, 14-17, 22-27
aredis_om/connections.py                    10      1    90%   20
aredis_om/model/__init__.py                  2      0   100%
aredis_om/model/cli/__init__.py              0      0   100%
aredis_om/model/cli/migrate.py              13     13     0%   1-18
aredis_om/model/encoders.py                 73     35    52%   69, 71, 74-87, 95, 97, 99, 134-149, 152-157, 161-175
aredis_om/model/migrations/__init__.py       0      0   100%
aredis_om/model/migrations/migrator.py      89     15    83%   24-35, 45, 83-84, 89-90, 101, 112-114, 134
aredis_om/model/model.py                  1121    138    88%   76, 120, 131, 151, 159, 168-175, 197, 216, 224, 230, 234, 238, 242-245, 249, 272, 276, 377, 426, 471, 478, 517, 544, 573, 575, 602, 605-611, 631, 633, 637, 665-675, 739, 784, 798-803, 816, 828, 830, 832, 868-870, 919, 940, 976-981, 997-1007, 1057, 1086-1087, 1150, 1367, 1370, 1414, 1427, 1445, 1449, 1454, 1481, 1488, 1523-1526, 1534, 1556-1563, 1613, 1648-1650, 1656, 1660, 1698-1706, 1[718](https://github.com/redis/redis-om-python/actions/runs/14759909517/job/41437834087#step:10:719)-1721, 1751, 1768-1777, 1779, 1795-1803, 1805, 1811, 1822-1832, 1848, 1944, 2008-2009, 2031-2034, 2054, 2125, 2142, 2144, 2148, 2154
aredis_om/model/query_resolver.py           23     23     0%   1-103
aredis_om/model/render_tree.py              34     31     9%   26-77
aredis_om/model/token_escaper.py            13      1    92%   16
aredis_om/sync_redis.py                      1      1     0%   1
aredis_om/util.py                            6      1    83%   7
----------------------------------------------------------------------
TOTAL                                     1411    271    81%

=========================== short test summary info ============================
FAILED tests/test_hash_model.py::test_pagination_queries - AssertionError: assert [Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.'), Member(id=0, first_name='Andrew', last_name='Brookins', email='a@example.com', join_date=datetime.date(2025, 4, 30), age=38, bio='This is member 1 whose greatness makes him the life and soul of any party he goes to.')] == [Member(id=0, first_name='Andrew', last_name='Brookins', email='a@example.com', join_date=datetime.date(2025, 4, 30), age=38, bio='This is member 1 whose greatness makes him the life and soul of any party he goes to.'), Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.')]
  
  At index 0 diff: Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.') != Member(id=0, first_name='Andrew', last_name='Brookins', email='a@example.com', join_date=datetime.date(2025, 4, 30), age=38, bio='This is member 1 whose greatness makes him the life and soul of any party he goes to.')
  
  Full diff:
    [
  +     Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.'),
        Member(id=0, first_name='Andrew', last_name='Brookins', email='a@example.com', join_date=datetime.date(2025, 4, 30), age=38, bio='This is member 1 whose greatness makes him the life and soul of any party he goes to.'),
  -     Member(id=1, first_name='Kim', last_name='Brookins', email='k@example.com', join_date=datetime.date(2025, 4, 30), age=34, bio='This is member 2 who can be quite anxious until you get to know them.'),
    ]
================== 1 failed, 281 passed, 6 warnings in 7.93s ===================

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions