diff --git a/openedx/core/djangoapps/util/management/commands/print_setting.py b/openedx/core/djangoapps/util/management/commands/print_setting.py index 52898fb878..d973e2ed4c 100644 --- a/openedx/core/djangoapps/util/management/commands/print_setting.py +++ b/openedx/core/djangoapps/util/management/commands/print_setting.py @@ -9,7 +9,7 @@ Useful when paver or a shell script needs such a value. This handles the one specific use case of the "print_settings" command from django-extensions that we were actually using. """ -from __future__ import print_function +from __future__ import absolute_import, print_function from django.conf import settings from django.core.management.base import BaseCommand, CommandError diff --git a/openedx/core/djangoapps/util/management/commands/reset_db.py b/openedx/core/djangoapps/util/management/commands/reset_db.py index 9541def572..da0e13308a 100644 --- a/openedx/core/djangoapps/util/management/commands/reset_db.py +++ b/openedx/core/djangoapps/util/management/commands/reset_db.py @@ -12,7 +12,8 @@ django-extensions that we were actually using. originally from http://www.djangosnippets.org/snippets/828/ by dnordberg """ -from __future__ import print_function +from __future__ import absolute_import, print_function + import logging import django diff --git a/openedx/core/djangoapps/util/tests/test_print_setting.py b/openedx/core/djangoapps/util/tests/test_print_setting.py index 0487f7fe99..ebdaa5ec97 100644 --- a/openedx/core/djangoapps/util/tests/test_print_setting.py +++ b/openedx/core/djangoapps/util/tests/test_print_setting.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals import pytest -from django.core.management import call_command, CommandError +from django.core.management import CommandError, call_command def test_without_args(capsys): diff --git a/openedx/core/djangoapps/util/tests/test_signals.py b/openedx/core/djangoapps/util/tests/test_signals.py index 003784aca9..0a613cd4da 100644 --- a/openedx/core/djangoapps/util/tests/test_signals.py +++ b/openedx/core/djangoapps/util/tests/test_signals.py @@ -1,8 +1,10 @@ # pylint: disable=no-member, missing-docstring +from __future__ import absolute_import + from unittest import TestCase + from celery.task import task from django.test.utils import override_settings - from edx_django_utils.cache import RequestCache diff --git a/openedx/core/djangoapps/util/tests/test_user_messages.py b/openedx/core/djangoapps/util/tests/test_user_messages.py index bcbcc5ea7e..7eef9853b4 100644 --- a/openedx/core/djangoapps/util/tests/test_user_messages.py +++ b/openedx/core/djangoapps/util/tests/test_user_messages.py @@ -2,8 +2,9 @@ Unit tests for user messages. """ -import ddt +from __future__ import absolute_import +import ddt from django.contrib.messages.middleware import MessageMiddleware from django.test import RequestFactory, TestCase diff --git a/openedx/core/djangoapps/util/tests/test_user_utils.py b/openedx/core/djangoapps/util/tests/test_user_utils.py index 05fee5b4a2..bdc9897fd8 100644 --- a/openedx/core/djangoapps/util/tests/test_user_utils.py +++ b/openedx/core/djangoapps/util/tests/test_user_utils.py @@ -1,8 +1,12 @@ """Tests for util.user_utils module.""" +from __future__ import absolute_import + import unittest +import six from django.contrib.auth.models import AnonymousUser + from ..user_utils import SystemUser @@ -18,7 +22,7 @@ class SystemUserTestCase(unittest.TestCase): self.assertIsNone(self.sysuser.id) def test_system_user_has_custom_unicode_representation(self): - self.assertNotEqual(unicode(self.sysuser), unicode(AnonymousUser())) + self.assertNotEqual(six.text_type(self.sysuser), six.text_type(AnonymousUser())) def test_system_user_is_not_staff(self): self.assertFalse(self.sysuser.is_staff)