from datetime import datetime, timedelta

from contextlib import contextmanager
from freezegun import freeze_time


@contextmanager
def active_phase(module, phase_type):
    now = datetime.now()
    phase = module.phase_set.create(
        start_date=now,
        end_date=now + timedelta(days=1),
        name='TEST PHASE',
        description='TEST DESCRIPTION',
        type=phase_type().identifier,
        weight=0,
    )

    with freeze_time(phase.start_date):
        yield

    phase.delete()

@@ -2,23 +2,45 @@
 rom 
-datetime import
+contextlib import contextmanager%0Afrom
  dat
@@ -44,17 +44,23 @@
 datetime
-,
+ import
  timedel
@@ -66,46 +66,41 @@
 lta%0A
-%0A
 from 
-contextlib import contextmanager
+django.utils import timezone
 %0Afro
@@ -196,23 +196,23 @@
   now = 
-datetim
+timezon
 e.now()%0A

make helpers.py use timezone.now