Skip to content

test_sent_is_every_thread_written_in_not_the_last_word is order-dependent #237

Description

@rutgerhofste

tests/test_conversation_api.py::TestConversationApi::test_sent_is_every_thread_written_in_not_the_last_word failed once and passed on the next run of the same commit, and 19.0 passed on the same machine in between. Not caused by the change it showed up under.

AssertionError: 'Offerte' != 'Re: Offerte'
 : the row is the conversation, not the mail we sent

The test creates both messages through _mail(), which passes no date, so Odoo stamps both with now() truncated to the second. When they land in the same second the two rows share a date, and _newest_per_group then picks whichever the query returned last -- so which message becomes the row is undefined, and the assertion holds or does not by timing.

tools/ui_preview.sh already learned this ("a seed that lets Postgres stamp everything now() opens on whichever record sorts first when the seed happens to straddle a second"); the fix here is the same one: give the two messages explicit dates a minute apart, so the newest is the newest by construction. Worth checking the other tests in that file that build a thread through _mail() without dates.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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