Skip to content

datetime patching bug #584

@liampauling

Description

@liampauling

The current simulation code patches datetime.datetime here this works for any import of datetime but fails on any modules that have already imported the datetime class via from datetime import datetime

import datetime
from datetime import datetime as dt

datetime.datetime.utcnow() == config.publish_time
dt.utcnow() != config.pubish_time

In order to do this each module needs to be cycled and patched accordingly as well as being unpatched on exit, the freezegun library does something similar with this scary code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions