

@contextmanager
def override_database_connection_timezone(self, timezone):
    try:
        orig_timezone = connection.settings_dict['TIME_ZONE']
        connection.settings_dict['TIME_ZONE'] = timezone
        connection.timezone
        del connection.timezone
        connection.timezone_name
        del connection.timezone_name
        (yield)
    finally:
        connection.settings_dict['TIME_ZONE'] = orig_timezone
        connection.timezone
        del connection.timezone
        connection.timezone_name
        del connection.timezone_name

dataset/ETHPy150Open django/django/tests/timezones/tests.py ForcedTimeZoneDatabaseTests.override_database_connection_timezone/original