def mock_datetime_now(monkeypatch):
    """Monkey patch datetime.datetime.now
    Returns a function that takes datetime as string as input
    and sets that to datetime.datetime.now()"""
    class mockdatetime(datetime.datetime):
        _freezed_datetime = None
        @classmethod
        def now(cls):
            return cls._freezed_datetime

    def wrapper(dt):
        dt = parse_datetime(dt)

        # Mock datetime.datetime
        mockdatetime._freezed_datetime = mockdatetime(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond)
        monkeypatch.setattr(datetime, 'datetime', mockdatetime)

        # Mock time.time
        mocktime = dt.timestamp()
        monkeypatch.setattr(time, 'time', lambda: mocktime)

    yield wrapper
Monkey patch datetime.datetime.now
Returns a function that takes datetime as string as input
and sets that to datetime.datetime.now()
rocketry/test/conftest.py