From 6e88c2d26edd466c702cfa3054dce9af17e9c6da Mon Sep 17 00:00:00 2001 From: bmedx Date: Fri, 3 Mar 2017 17:03:35 -0500 Subject: [PATCH] Linting fixes --- cms/djangoapps/cms_user_tasks/signals.py | 2 +- cms/djangoapps/cms_user_tasks/tests.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cms/djangoapps/cms_user_tasks/signals.py b/cms/djangoapps/cms_user_tasks/signals.py index b687088f9f..e21924080c 100644 --- a/cms/djangoapps/cms_user_tasks/signals.py +++ b/cms/djangoapps/cms_user_tasks/signals.py @@ -4,7 +4,7 @@ Receivers of signals sent from django-user-tasks from __future__ import absolute_import, print_function, unicode_literals import logging -from six.moves.urllib.parse import urljoin +from six.moves.urllib.parse import urljoin # pylint: disable=import-error from django.core.urlresolvers import reverse from django.dispatch import receiver diff --git a/cms/djangoapps/cms_user_tasks/tests.py b/cms/djangoapps/cms_user_tasks/tests.py index 7efd4c6f7f..ae967d0c77 100644 --- a/cms/djangoapps/cms_user_tasks/tests.py +++ b/cms/djangoapps/cms_user_tasks/tests.py @@ -4,7 +4,6 @@ Unit tests for integration of the django-user-tasks app and its REST API. from __future__ import absolute_import, print_function, unicode_literals -import sys from uuid import uuid4 import logging @@ -23,16 +22,24 @@ from user_tasks.serializers import ArtifactSerializer, StatusSerializer from .signals import user_task_stopped -# Mock logging handler to check for expected logs. class MockLoggingHandler(logging.Handler): + """ + Mock logging handler to help check for logging statements + """ def __init__(self, *args, **kwargs): self.reset() logging.Handler.__init__(self, *args, **kwargs) def emit(self, record): + """ + Override to catch messages and store them messages in our internal dicts + """ self.messages[record.levelname.lower()].append(record.getMessage()) def reset(self): + """ + Clear out all messages, also called to initially populate messages dict + """ self.messages = { 'debug': [], 'info': [], @@ -41,8 +48,8 @@ class MockLoggingHandler(logging.Handler): 'critical': [], } -# Helper functions for stuff that pylint complains about without disable comments +# Helper functions for stuff that pylint complains about without disable comments def _context(response): """ Get a context dictionary for a serializer appropriate for the given response.