From 62d70dbd4d59f6d67d26155241911c5a65b29998 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Wed, 8 Aug 2018 17:01:32 +0100 Subject: [PATCH] use contextmanager freeze time instead of decorator it doesn't appear to work nicely with pytest fixtures in the newer versions of pytest --- tests/app/letters/test_letter_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/app/letters/test_letter_utils.py b/tests/app/letters/test_letter_utils.py index 8d5f5017c..2430c57cf 100644 --- a/tests/app/letters/test_letter_utils.py +++ b/tests/app/letters/test_letter_utils.py @@ -21,13 +21,13 @@ FROZEN_DATE_TIME = "2018-03-14 17:00:00" @pytest.fixture() -@freeze_time(FROZEN_DATE_TIME) def sample_precompiled_letter_notification_using_test_key(sample_letter_notification): sample_letter_notification.template.hidden = True sample_letter_notification.template.name = PRECOMPILED_TEMPLATE_NAME sample_letter_notification.key_type = KEY_TYPE_TEST sample_letter_notification.reference = 'foo' - sample_letter_notification.created_at = datetime.utcnow() + with freeze_time(FROZEN_DATE_TIME): + sample_letter_notification.created_at = datetime.utcnow() return sample_letter_notification