From 7d82f32f5bdb8e6862e144b49b2dc97585cb89a1 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Fri, 17 Feb 2017 09:47:17 -0500 Subject: [PATCH] Fix issue with test ordering The second test here is not idempotent, so we must needs reset the course before each test. --- lms/djangoapps/grades/tests/integration/test_events.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/grades/tests/integration/test_events.py b/lms/djangoapps/grades/tests/integration/test_events.py index c177e9a124..b6ce701130 100644 --- a/lms/djangoapps/grades/tests/integration/test_events.py +++ b/lms/djangoapps/grades/tests/integration/test_events.py @@ -8,7 +8,6 @@ from lms.djangoapps.instructor.enrollment import reset_student_attempts from lms.djangoapps.instructor_task.api import submit_rescore_problem_for_student from mock import patch from openedx.core.djangolib.testing.utils import get_mock_request -from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory @@ -28,8 +27,10 @@ class GradesEventIntegrationTest(ProblemSubmissionTestMixin, SharedModuleStoreTe of the grading infrastructure. """ @classmethod - def setUpClass(cls): - super(GradesEventIntegrationTest, cls).setUpClass() + def reset_course(cls): + """ + Sets up the course anew. + """ with cls.store.default_store(ModuleStoreEnum.Type.split): cls.course = CourseFactory.create() cls.chapter = ItemFactory.create( @@ -63,6 +64,7 @@ class GradesEventIntegrationTest(ProblemSubmissionTestMixin, SharedModuleStoreTe ) def setUp(self): + self.reset_course() super(GradesEventIntegrationTest, self).setUp() self.request = get_mock_request(UserFactory()) self.student = self.request.user