
import redis

from mongoengine.connection import connect, disconnect

from django.conf import settings

TEST_REDIS = redis.StrictRedis(host=settings.REDIS_TEST_HOST,
                               port=settings.REDIS_TEST_PORT,
                               db=settings.REDIS_TEST_DB)


def connect_mongodb_testsuite():
    disconnect()
    connect('{0}_testsuite'.format(settings.MONGODB_NAME))


__all__ = ('TEST_REDIS', 'connect_mongodb_testsuite', )


import redis

from mongoengine.connection import connect, disconnect

from django.conf import settings

TEST_REDIS = redis.StrictRedis(host=settings.REDIS_TEST_HOST,
                               port=settings.REDIS_TEST_PORT,
                               db=settings.REDIS_TEST_DB)


def connect_mongodb_testsuite():
    disconnect()
    connect('{0}_testsuite'.format(settings.MONGODB_NAME),
            tz_aware=settings.USE_TZ)


__all__ = ('TEST_REDIS', 'connect_mongodb_testsuite', )

Make the test MongoDB database TZ aware like the production one, else some date comparisons fail, whereas they succeed in production.
Make the test MongoDB database TZ aware like the production one, else some date comparisons fail, whereas they succeed in production.

  
  import redis
  
  from mongoengine.connection import connect, disconnect
  
  from django.conf import settings
  
  TEST_REDIS = redis.StrictRedis(host=settings.REDIS_TEST_HOST,
                                 port=settings.REDIS_TEST_PORT,
                                 db=settings.REDIS_TEST_DB)
  
  
  def connect_mongodb_testsuite():
      disconnect()
-     connect('{0}_testsuite'.format(settings.MONGODB_NAME))
+     connect('{0}_testsuite'.format(settings.MONGODB_NAME),
+             tz_aware=settings.USE_TZ)
  
  
  __all__ = ('TEST_REDIS', 'connect_mongodb_testsuite', )
  
Make the test MongoDB database TZ aware like the production one, else some date comparisons fail, whereas they succeed in production.
## Code Before:

import redis

from mongoengine.connection import connect, disconnect

from django.conf import settings

TEST_REDIS = redis.StrictRedis(host=settings.REDIS_TEST_HOST,
                               port=settings.REDIS_TEST_PORT,
                               db=settings.REDIS_TEST_DB)


def connect_mongodb_testsuite():
    disconnect()
    connect('{0}_testsuite'.format(settings.MONGODB_NAME))


__all__ = ('TEST_REDIS', 'connect_mongodb_testsuite', )

## Instruction:
Make the test MongoDB database TZ aware like the production one, else some date comparisons fail, whereas they succeed in production.
## Code After:

import redis

from mongoengine.connection import connect, disconnect

from django.conf import settings

TEST_REDIS = redis.StrictRedis(host=settings.REDIS_TEST_HOST,
                               port=settings.REDIS_TEST_PORT,
                               db=settings.REDIS_TEST_DB)


def connect_mongodb_testsuite():
    disconnect()
    connect('{0}_testsuite'.format(settings.MONGODB_NAME),
            tz_aware=settings.USE_TZ)


__all__ = ('TEST_REDIS', 'connect_mongodb_testsuite', )
