Fake utcnow for the pytest
According to this, subclassing datetime.datetime seems the way to go.

There is no use for the str_2_time method though. You can easily inline this, or even simpler, just use the datetime.datetime constructor:

def test_patch_datetime():
    for utc_time in [
        dt.datetime(2019, 1, 1, 10),
        dt.datetime(2019, 2, 1, 13),
        dt.datetime(2019, 3, 1, 16),
    ]:
        FakeTime.fake_time = utc_time
        dt.datetime = FakeTime
        assert dt.datetime.utcnow() == utc_time


You should be aware that this can have side effects in other parts of your code, so it might be needed to replace it back with the original class after  the test method:

def test_patch_datetime():
    datetime_orig = dt.datetime

    utc_times = [
        dt.datetime(2019, 1, 1, 10),
        dt.datetime(2019, 2, 1, 13),
        dt.datetime(2019, 3, 1, 16),
    ]
    for utc_time in utc_times:
        FakeTime.fake_time = utc_time
        dt.datetime = FakeTime
        assert dt.datetime.utcnow() == utc_time
    dt.datetime = datetime_orig
    # print(dt.datetime.utcnow())
    assert dt.datetime.utcnow() &gt; max(utc_times)