Skip to content

TypeError: '>=' not supported between instances of 'str' and 'datetime.datetime' #1218

Description

@Carreau

There is a new downstream failure

TypeError: '>=' not supported between instances of 'str' and 'datetime.datetime'

For example:

https://github.com/ipython/ipython/actions/runs/8138250074/job/22238601371?pr=14360

Originally posted by @Carreau in #1210 (comment)

Activity

  1. ianthomas23 commented on Mar 4, 2024

    @ianthomas23
    Collaborator

    Copied from the linked, previously-merged, PR:

    These are the same symptoms that I observed at #1210 (comment). ipyparallel unfortunately monkey-patches jupyter_clients conversion of strings to datetimes so it is a no-op, and some versions of pytest-asyncio don't fully isolate the tests so sometimes some of these start and end dates come through as strings.

    In this PR updating pytest-asyncio to 0.23.5 worked, but this is evidently not sufficient as the IPython failure already uses pytest-asyncio-0.23.5.

    I think the sensible approach here is to assume that in this test sometimes, outside of our direct control, the dates are strings and convert them to datetimes. Otherwise this test is not testing what it is supposed to, it is testing the types of some fields returned in messages. I'll submit a PR here ASAP.

  2. Carreau commented on Mar 4, 2024

    @Carreau
    MemberAuthor

    Thanks, sorry I missed the earlier comment in the PR.

    If I might suggest, you may want to check if it's a string or a date and still emit a warning if it's a string so that upstream can slowly patch. It would be good to have reply messages always well typed.

  3. ianthomas23 commented on Mar 4, 2024

    @ianthomas23
    Collaborator

    I looked at issuing a warning in the test if an expected datetime is actually a string, but this will cause the tests to fail anyway unless we allow this warning in downstream CI.

    There is work underway at https://github.com/jupyter/schema/ to precisely specify the content and types of messages (and lots of other things) which will eventually be used in CI and will identify these sorts of inconsistencies.

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