From b0e87cd2f46ed6d34da33f4058667716c3511b66 Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Mon, 30 Mar 2015 10:29:42 -0600 Subject: [PATCH] code quality fixes --- common/lib/xmodule/xmodule/course_module.py | 2 +- lms/djangoapps/ccx/tests/test_views.py | 9 ++++++--- lms/djangoapps/courseware/tests/test_field_overrides.py | 1 + lms/djangoapps/instructor/tests/test_tools.py | 7 +++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index da916d9f0bf5..577bf15b75a8 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -833,7 +833,7 @@ class CourseFields(object): ) -class CourseModule(CourseFields, SequenceModule): +class CourseModule(CourseFields, SequenceModule): # pylint: disable=abstract-method """ The CourseDescriptor needs its module_class to be a SequenceModule, but some code that expects a CourseDescriptor to have all its fields can fail if it gets a SequenceModule instead. diff --git a/lms/djangoapps/ccx/tests/test_views.py b/lms/djangoapps/ccx/tests/test_views.py index 46a7d28dbb7c..d32118337527 100644 --- a/lms/djangoapps/ccx/tests/test_views.py +++ b/lms/djangoapps/ccx/tests/test_views.py @@ -120,6 +120,7 @@ def tearDown(self): """ Undo patches. """ + super(TestCoachDashboard, self).tearDown() patch.stopall() def test_not_a_coach(self): @@ -419,11 +420,13 @@ def test_manage_remove_single_student(self): ) -original_get_children = XModuleMixin.get_children +GET_CHILDREN = XModuleMixin.get_children + + def patched_get_children(self, usage_key_filter=None): # pylint: disable=missing-docstring def iter_children(): # pylint: disable=missing-docstring print self.__dict__ - for child in original_get_children(self, usage_key_filter=usage_key_filter): + for child in GET_CHILDREN(self, usage_key_filter=usage_key_filter): child._field_data_cache = {} # pylint: disable=protected-access if not child.visible_to_staff_only: yield child @@ -492,7 +495,7 @@ def setUp(self): for block in iter_blocks(course): block._field_data = OverrideFieldData.wrap( # pylint: disable=protected-access coach, block._field_data) # pylint: disable=protected-access - block._field_data_cache = {'tabs':[],'discussion_topics':[]} # pylint: disable=protected-access + block._field_data_cache = {'tabs': [], 'discussion_topics': []} # pylint: disable=protected-access def cleanup_provider_classes(): """ diff --git a/lms/djangoapps/courseware/tests/test_field_overrides.py b/lms/djangoapps/courseware/tests/test_field_overrides.py index 76cd636c917e..1504be6d4806 100644 --- a/lms/djangoapps/courseware/tests/test_field_overrides.py +++ b/lms/djangoapps/courseware/tests/test_field_overrides.py @@ -30,6 +30,7 @@ def setUp(self): OverrideFieldData.provider_classes = None def tearDown(self): + super(OverrideFieldDataTests, self).tearDown() OverrideFieldData.provider_classes = None def make_one(self): diff --git a/lms/djangoapps/instructor/tests/test_tools.py b/lms/djangoapps/instructor/tests/test_tools.py index 7be040a67440..17a08c72edae 100644 --- a/lms/djangoapps/instructor/tests/test_tools.py +++ b/lms/djangoapps/instructor/tests/test_tools.py @@ -10,9 +10,8 @@ from django.utils.timezone import utc from django.test.utils import override_settings -from courseware.models import StudentModule -from courseware.field_overrides import OverrideFieldData -from student.tests.factories import UserFactory +from courseware.field_overrides import OverrideFieldData # pylint: disable=import-error +from student.tests.factories import UserFactory # pylint: disable=import-error from xmodule.fields import Date from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory @@ -222,6 +221,7 @@ def setUp(self): user, block._field_data) # pylint: disable=protected-access def tearDown(self): + super(TestSetDueDateExtension, self).tearDown() OverrideFieldData.provider_classes = None def _clear_field_data_cache(self): @@ -280,7 +280,6 @@ def setUp(self): course = CourseFactory.create() week1 = ItemFactory.create(due=due, parent=course) week2 = ItemFactory.create(due=due, parent=course) - week3 = ItemFactory.create(due=due, parent=course) homework = ItemFactory.create( parent=week1,