Skip to content

time freezing doesn't work properly with zyte-common-items #125

@kmike

Description

@kmike

I tried to use scrapy-poet's savefixture together with Product item from zyte-common-items. The result:

meta.json:

{
    "frozen_time": "2023-01-31T17:25:54.362413+00:00"
}

output.json:

    "metadata": {
        "dateDownloaded": "2023-01-31T17:25:55Z",
        "probability": 1.0
    },

And then, comparison fails when running pytest, on a freshly generated fixture:

E         -  'metadata': {'dateDownloaded': '2023-01-31T17:25:55Z', 'probability': 1.0},
E         ?                                                    ^
E         +  'metadata': {'dateDownloaded': '2023-01-31T17:25:54Z', 'probability': 1.0},
E         ?                                                    ^

Seems to be some issue with rounding, but I'm not sure; haven't checked it. Another possibile explanation is that without freezing the time during test generation the time can change.

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