From ddb1ae667e7831f3e089cefd41304e239613a8f5 Mon Sep 17 00:00:00 2001 From: Christine Lytwynec Date: Wed, 29 Apr 2015 14:21:28 -0400 Subject: [PATCH] Split lms unittests into multiple shards --- lms/djangoapps/branding/tests/test_models.py | 3 +++ lms/djangoapps/branding/tests/test_page.py | 4 ++++ .../bulk_email/tests/test_course_optout.py | 2 ++ lms/djangoapps/bulk_email/tests/test_email.py | 3 +++ .../bulk_email/tests/test_err_handling.py | 2 ++ lms/djangoapps/bulk_email/tests/test_forms.py | 2 ++ .../bulk_email/tests/test_models.py | 5 +++++ lms/djangoapps/bulk_email/tests/test_tasks.py | 2 ++ lms/djangoapps/ccx/tests/test_models.py | 3 +++ lms/djangoapps/ccx/tests/test_overrides.py | 2 ++ lms/djangoapps/ccx/tests/test_utils.py | 7 +++++++ lms/djangoapps/ccx/tests/test_views.py | 4 ++++ lms/djangoapps/certificates/tests/test_api.py | 5 +++++ .../tests/test_create_fake_cert.py | 2 ++ .../certificates/tests/test_models.py | 3 +++ .../certificates/tests/test_queue.py | 3 +++ .../tests/test_resubmit_error_certificates.py | 2 ++ .../certificates/tests/test_views.py | 3 +++ lms/djangoapps/certificates/tests/tests.py | 2 ++ .../tests/test_dashboard_data.py | 2 ++ .../class_dashboard/tests/test_views.py | 2 ++ lms/djangoapps/commerce/tests/test_views.py | 4 ++++ .../course_wiki/tests/test_access.py | 5 +++++ .../course_wiki/tests/test_middleware.py | 2 ++ lms/djangoapps/course_wiki/tests/tests.py | 2 ++ .../commands/tests/test_clean_history.py | 4 ++++ .../commands/tests/test_dump_course.py | 2 ++ lms/djangoapps/courseware/tests/test_about.py | 8 +++++++ .../courseware/tests/test_access.py | 3 +++ .../courseware/tests/test_course_info.py | 3 +++ .../courseware/tests/test_course_survey.py | 2 ++ .../courseware/tests/test_courses.py | 8 +++++++ .../tests/test_draft_modulestore.py | 2 ++ .../courseware/tests/test_entrance_exam.py | 2 ++ .../courseware/tests/test_favicon.py | 2 ++ .../courseware/tests/test_field_overrides.py | 3 +++ .../courseware/tests/test_footer.py | 2 ++ .../courseware/tests/test_grades.py | 2 ++ .../courseware/tests/test_group_access.py | 2 ++ lms/djangoapps/courseware/tests/test_i18n.py | 2 ++ .../courseware/tests/test_lti_integration.py | 3 +++ .../courseware/tests/test_masquerade.py | 4 ++++ .../courseware/tests/test_microsites.py | 2 ++ .../courseware/tests/test_middleware.py | 2 ++ .../courseware/tests/test_model_data.py | 6 ++++++ .../courseware/tests/test_module_render.py | 17 +++++++++++++++ .../courseware/tests/test_navigation.py | 2 ++ .../courseware/tests/test_password_history.py | 2 ++ .../courseware/tests/test_recommender.py | 6 ++++++ .../courseware/tests/test_split_module.py | 3 +++ .../tests/test_submitting_problems.py | 6 ++++++ lms/djangoapps/courseware/tests/test_tabs.py | 5 +++++ .../courseware/tests/test_video_handlers.py | 8 +++++++ .../courseware/tests/test_video_mongo.py | 6 ++++++ .../courseware/tests/test_video_xml.py | 2 ++ .../tests/test_view_authentication.py | 3 +++ lms/djangoapps/courseware/tests/test_views.py | 10 +++++++++ .../courseware/tests/test_word_cloud.py | 2 ++ lms/djangoapps/courseware/tests/tests.py | 6 ++++++ .../dashboard/tests/test_support.py | 2 ++ .../dashboard/tests/test_sysadmin.py | 3 +++ .../tests/test_middleware.py | 2 ++ .../tests/test_models.py | 3 +++ .../django_comment_client/tests/test_utils.py | 7 +++++++ .../instructor/tests/test_access.py | 5 +++++ lms/djangoapps/instructor/tests/test_api.py | 18 ++++++++++++++++ .../tests/test_api_email_localization.py | 2 ++ .../instructor/tests/test_certificates.py | 3 +++ .../instructor/tests/test_ecommerce.py | 2 ++ lms/djangoapps/instructor/tests/test_email.py | 3 +++ .../instructor/tests/test_enrollment.py | 8 +++++++ .../instructor/tests/test_hint_manager.py | 2 ++ .../tests/test_legacy_enrollment.py | 2 ++ .../tests/test_legacy_raw_download_csv.py | 2 ++ .../instructor/tests/test_legacy_xss.py | 2 ++ .../instructor/tests/test_spoc_gradebook.py | 4 ++++ lms/djangoapps/instructor/tests/test_tools.py | 10 +++++++++ scripts/all-tests.sh | 21 +++++++++++-------- scripts/jenkins-report.sh | 3 +++ 79 files changed, 313 insertions(+), 9 deletions(-) diff --git a/lms/djangoapps/branding/tests/test_models.py b/lms/djangoapps/branding/tests/test_models.py index 7d0876bdb0..d03f155921 100644 --- a/lms/djangoapps/branding/tests/test_models.py +++ b/lms/djangoapps/branding/tests/test_models.py @@ -3,9 +3,12 @@ Tests for the Video Branding configuration. """ from django.test import TestCase from django.core.exceptions import ValidationError +from nose.plugins.attrib import attr + from branding.models import BrandingInfoConfig +@attr('shard_1') class BrandingInfoConfigTest(TestCase): """ Test the BrandingInfoConfig model. diff --git a/lms/djangoapps/branding/tests/test_page.py b/lms/djangoapps/branding/tests/test_page.py index dabcc6f8e0..253733a37c 100644 --- a/lms/djangoapps/branding/tests/test_page.py +++ b/lms/djangoapps/branding/tests/test_page.py @@ -12,6 +12,7 @@ from django.test.client import RequestFactory from pytz import UTC from mock import patch, Mock +from nose.plugins.attrib import attr from edxmako.shortcuts import render_to_response from branding.views import index @@ -43,6 +44,7 @@ def mock_render_to_response(*args, **kwargs): RENDER_MOCK = Mock(side_effect=mock_render_to_response) +@attr('shard_1') class AnonymousIndexPageTest(ModuleStoreTestCase): """ Tests that anonymous users can access the '/' page, Need courses with start date @@ -116,6 +118,7 @@ class AnonymousIndexPageTest(ModuleStoreTestCase): self.assertEqual(response._headers.get("location")[1], "/login") # pylint: disable=protected-access +@attr('shard_1') class PreRequisiteCourseCatalog(ModuleStoreTestCase, LoginEnrollmentTestCase): """ Test to simulate and verify fix for disappearing courses in @@ -163,6 +166,7 @@ class PreRequisiteCourseCatalog(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertIn('course that has pre requisite', resp.content) +@attr('shard_1') class IndexPageCourseCardsSortingTests(ModuleStoreTestCase): """ Test for Index page course cards sorting diff --git a/lms/djangoapps/bulk_email/tests/test_course_optout.py b/lms/djangoapps/bulk_email/tests/test_course_optout.py index 05f478aa84..e72edd222d 100644 --- a/lms/djangoapps/bulk_email/tests/test_course_optout.py +++ b/lms/djangoapps/bulk_email/tests/test_course_optout.py @@ -4,6 +4,7 @@ Unit tests for student optouts from course email """ import json from mock import patch, Mock +from nose.plugins.attrib import attr from django.core import mail from django.core.management import call_command @@ -16,6 +17,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory +@attr('shard_1') @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message')) class TestOptoutCourseEmails(ModuleStoreTestCase): """ diff --git a/lms/djangoapps/bulk_email/tests/test_email.py b/lms/djangoapps/bulk_email/tests/test_email.py index 874712523c..3732d72d48 100644 --- a/lms/djangoapps/bulk_email/tests/test_email.py +++ b/lms/djangoapps/bulk_email/tests/test_email.py @@ -4,6 +4,7 @@ Unit tests for sending course email """ import json from mock import patch, Mock +from nose.plugins.attrib import attr import os from unittest import skipIf @@ -85,6 +86,7 @@ class EmailSendFromDashboardTestCase(ModuleStoreTestCase): } +@attr('shard_1') @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message')) class TestEmailSendFromDashboardMockedHtmlToText(EmailSendFromDashboardTestCase): @@ -313,6 +315,7 @@ class TestEmailSendFromDashboardMockedHtmlToText(EmailSendFromDashboardTestCase) self.assertItemsEqual(outbox_contents, should_send_contents) +@attr('shard_1') @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) @skipIf(os.environ.get("TRAVIS") == 'true', "Skip this test in Travis CI.") class TestEmailSendFromDashboard(EmailSendFromDashboardTestCase): diff --git a/lms/djangoapps/bulk_email/tests/test_err_handling.py b/lms/djangoapps/bulk_email/tests/test_err_handling.py index 818eeb5fca..9b8db791d9 100644 --- a/lms/djangoapps/bulk_email/tests/test_err_handling.py +++ b/lms/djangoapps/bulk_email/tests/test_err_handling.py @@ -11,6 +11,7 @@ from django.core.urlresolvers import reverse from django.db import DatabaseError import json from mock import patch, Mock +from nose.plugins.attrib import attr from smtplib import SMTPDataError, SMTPServerDisconnected, SMTPConnectError from bulk_email.models import CourseEmail, SEND_TO_ALL @@ -35,6 +36,7 @@ class EmailTestException(Exception): pass +@attr('shard_1') @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message')) @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) class TestEmailErrors(ModuleStoreTestCase): diff --git a/lms/djangoapps/bulk_email/tests/test_forms.py b/lms/djangoapps/bulk_email/tests/test_forms.py index 863c4abe95..e9b03760d9 100644 --- a/lms/djangoapps/bulk_email/tests/test_forms.py +++ b/lms/djangoapps/bulk_email/tests/test_forms.py @@ -4,6 +4,7 @@ Unit tests for bulk-email-related forms. """ from django.conf import settings from mock import patch +from nose.plugins.attrib import attr from bulk_email.models import CourseAuthorization, CourseEmailTemplate from bulk_email.forms import CourseAuthorizationAdminForm, CourseEmailTemplateForm @@ -15,6 +16,7 @@ from xmodule.modulestore.django import modulestore from xmodule.modulestore import ModuleStoreEnum +@attr('shard_1') class CourseAuthorizationFormTest(ModuleStoreTestCase): """Test the CourseAuthorizationAdminForm form for Mongo-backed courses.""" diff --git a/lms/djangoapps/bulk_email/tests/test_models.py b/lms/djangoapps/bulk_email/tests/test_models.py index f8a7351922..a52fd137f2 100644 --- a/lms/djangoapps/bulk_email/tests/test_models.py +++ b/lms/djangoapps/bulk_email/tests/test_models.py @@ -8,11 +8,13 @@ from django.conf import settings from student.tests.factories import UserFactory from mock import patch, Mock +from nose.plugins.attrib import attr from bulk_email.models import CourseEmail, SEND_TO_STAFF, CourseEmailTemplate, CourseAuthorization from opaque_keys.edx.locations import SlashSeparatedCourseKey +@attr('shard_1') @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message')) class CourseEmailTest(TestCase): """Test the CourseEmail model.""" @@ -57,6 +59,7 @@ class CourseEmailTest(TestCase): CourseEmail.create(course_id, sender, to_option, subject, html_message) +@attr('shard_1') class NoCourseEmailTemplateTest(TestCase): """Test the CourseEmailTemplate model without loading the template data.""" @@ -65,6 +68,7 @@ class NoCourseEmailTemplateTest(TestCase): CourseEmailTemplate.get_template() +@attr('shard_1') class CourseEmailTemplateTest(TestCase): """Test the CourseEmailTemplate model.""" @@ -134,6 +138,7 @@ class CourseEmailTemplateTest(TestCase): template.render_plaintext("My new plain text.", context) +@attr('shard_1') class CourseAuthorizationTest(TestCase): """Test the CourseAuthorization model.""" diff --git a/lms/djangoapps/bulk_email/tests/test_tasks.py b/lms/djangoapps/bulk_email/tests/test_tasks.py index 759025335a..19aee161ae 100644 --- a/lms/djangoapps/bulk_email/tests/test_tasks.py +++ b/lms/djangoapps/bulk_email/tests/test_tasks.py @@ -9,6 +9,7 @@ import json from uuid import uuid4 from itertools import cycle, chain, repeat from mock import patch, Mock +from nose.plugins.attrib import attr from smtplib import SMTPServerDisconnected, SMTPDataError, SMTPConnectError, SMTPAuthenticationError from boto.ses.exceptions import ( SESAddressNotVerifiedError, @@ -71,6 +72,7 @@ def my_update_subtask_status(entry_id, current_task_id, new_subtask_status): update_subtask_status(entry_id, current_task_id, new_subtask_status) +@attr('shard_1') @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message')) class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase): """Tests instructor task that send bulk email.""" diff --git a/lms/djangoapps/ccx/tests/test_models.py b/lms/djangoapps/ccx/tests/test_models.py index 4c2730648f..4162a8811e 100644 --- a/lms/djangoapps/ccx/tests/test_models.py +++ b/lms/djangoapps/ccx/tests/test_models.py @@ -4,6 +4,7 @@ tests for the models from datetime import datetime, timedelta from django.utils.timezone import UTC from mock import patch +from nose.plugins.attrib import attr from student.models import CourseEnrollment # pylint: disable=import-error from student.roles import CourseCcxCoachRole # pylint: disable=import-error from student.tests.factories import ( # pylint: disable=import-error @@ -29,6 +30,7 @@ from ..models import ( from ..overrides import override_field_for_ccx +@attr('shard_1') class TestCcxMembership(ModuleStoreTestCase): """Unit tests for the CcxMembership model """ @@ -135,6 +137,7 @@ class TestCcxMembership(ModuleStoreTestCase): self.assertTrue(self.has_ccx_future_membership(user)) +@attr('shard_1') class TestCCX(ModuleStoreTestCase): """Unit tests for the CustomCourseForEdX model """ diff --git a/lms/djangoapps/ccx/tests/test_overrides.py b/lms/djangoapps/ccx/tests/test_overrides.py index f6edd44a43..37a7a14d36 100644 --- a/lms/djangoapps/ccx/tests/test_overrides.py +++ b/lms/djangoapps/ccx/tests/test_overrides.py @@ -4,6 +4,7 @@ tests for overrides import datetime import mock import pytz +from nose.plugins.attrib import attr from courseware.field_overrides import OverrideFieldData # pylint: disable=import-error from django.test.utils import override_settings @@ -17,6 +18,7 @@ from ..overrides import override_field_for_ccx from .test_views import flatten, iter_blocks +@attr('shard_1') @override_settings(FIELD_OVERRIDE_PROVIDERS=( 'ccx.overrides.CustomCoursesForEdxOverrideProvider',)) class TestFieldOverrides(ModuleStoreTestCase): diff --git a/lms/djangoapps/ccx/tests/test_utils.py b/lms/djangoapps/ccx/tests/test_utils.py index cd44efe458..ca1fb6ac7c 100644 --- a/lms/djangoapps/ccx/tests/test_utils.py +++ b/lms/djangoapps/ccx/tests/test_utils.py @@ -1,6 +1,8 @@ """ test utils """ +from nose.plugins.attrib import attr + from ccx.models import ( # pylint: disable=import-error CcxMembership, CcxFutureMembership, @@ -21,6 +23,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory +@attr('shard_1') class TestEmailEnrollmentState(ModuleStoreTestCase): """unit tests for the EmailEnrollmentState class """ @@ -120,6 +123,7 @@ class TestEmailEnrollmentState(ModuleStoreTestCase): self.assertTrue(member in representation) +@attr('shard_1') # TODO: deal with changes in behavior for auto_enroll class TestGetEmailParams(ModuleStoreTestCase): """tests for ccx.utils.get_email_params @@ -176,6 +180,7 @@ class TestGetEmailParams(ModuleStoreTestCase): self.assertTrue(auto['auto_enroll']) +@attr('shard_1') # TODO: deal with changes in behavior for auto_enroll class TestEnrollEmail(ModuleStoreTestCase): """tests for the enroll_email function from ccx.utils @@ -356,6 +361,7 @@ class TestEnrollEmail(ModuleStoreTestCase): self.assertEqual(self.outbox, []) +@attr('shard_1') # TODO: deal with changes in behavior for auto_enroll class TestUnenrollEmail(ModuleStoreTestCase): """Tests for the unenroll_email function from ccx.utils""" @@ -504,6 +510,7 @@ class TestUnenrollEmail(ModuleStoreTestCase): self.assertEqual(self.outbox, []) +@attr('shard_1') class TestUserCCXList(ModuleStoreTestCase): """Unit tests for ccx.utils.get_all_ccx_for_user""" diff --git a/lms/djangoapps/ccx/tests/test_views.py b/lms/djangoapps/ccx/tests/test_views.py index b4c7e94883..85efd29d46 100644 --- a/lms/djangoapps/ccx/tests/test_views.py +++ b/lms/djangoapps/ccx/tests/test_views.py @@ -6,6 +6,7 @@ import json import re import pytz from mock import patch +from nose.plugins.attrib import attr from capa.tests.response_xml_factory import StringResponseXMLFactory from courseware.field_overrides import OverrideFieldData # pylint: disable=import-error @@ -55,6 +56,7 @@ def intercept_renderer(path, context): return response +@attr('shard_1') class TestCoachDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase): """ Tests for Custom Courses views. @@ -433,6 +435,7 @@ def patched_get_children(self, usage_key_filter=None): # pylint: disable=missin return list(iter_children()) +@attr('shard_1') @override_settings(FIELD_OVERRIDE_PROVIDERS=( 'ccx.overrides.CustomCoursesForEdxOverrideProvider',)) @patch('xmodule.x_module.XModuleMixin.get_children', patched_get_children, spec=True) @@ -584,6 +587,7 @@ class TestCCXGrades(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertEqual(len(grades['section_breakdown']), 4) +@attr('shard_1') class TestSwitchActiveCCX(ModuleStoreTestCase, LoginEnrollmentTestCase): """Verify the view for switching which CCX is active, if any """ diff --git a/lms/djangoapps/certificates/tests/test_api.py b/lms/djangoapps/certificates/tests/test_api.py index 3a6f2fae56..2ba4cc11ae 100644 --- a/lms/djangoapps/certificates/tests/test_api.py +++ b/lms/djangoapps/certificates/tests/test_api.py @@ -5,6 +5,7 @@ import ddt from django.test import TestCase, RequestFactory from django.test.utils import override_settings from mock import patch +from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from xmodule.modulestore.tests.factories import CourseFactory @@ -25,6 +26,7 @@ from certificates.queue import XQueueCertInterface, XQueueAddToQueueError from certificates.tests.factories import GeneratedCertificateFactory +@attr('shard_1') class CertificateDownloadableStatusTests(ModuleStoreTestCase): """Tests for the `certificate_downloadable_status` helper function. """ @@ -104,6 +106,7 @@ class CertificateDownloadableStatusTests(ModuleStoreTestCase): ) +@attr('shard_1') @override_settings(CERT_QUEUE='certificates') class GenerateUserCertificatesTest(ModuleStoreTestCase): """Tests for generating certificates for students. """ @@ -164,6 +167,7 @@ class GenerateUserCertificatesTest(ModuleStoreTestCase): yield mock_send_to_queue +@attr('shard_1') @ddt.ddt class CertificateGenerationEnabledTest(TestCase): """Test enabling/disabling self-generated certificates for a course. """ @@ -225,6 +229,7 @@ class CertificateGenerationEnabledTest(TestCase): self.assertEqual(expect_enabled, actual_enabled) +@attr('shard_1') class GenerateExampleCertificatesTest(TestCase): """Test generation of example certificates. """ diff --git a/lms/djangoapps/certificates/tests/test_create_fake_cert.py b/lms/djangoapps/certificates/tests/test_create_fake_cert.py index 47d615a1c5..1d2f95917e 100644 --- a/lms/djangoapps/certificates/tests/test_create_fake_cert.py +++ b/lms/djangoapps/certificates/tests/test_create_fake_cert.py @@ -1,6 +1,7 @@ """Tests for the create_fake_certs management command. """ from django.test import TestCase from django.core.management.base import CommandError +from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from student.tests.factories import UserFactory @@ -8,6 +9,7 @@ from certificates.management.commands import create_fake_cert from certificates.models import GeneratedCertificate +@attr('shard_1') class CreateFakeCertTest(TestCase): """Tests for the create_fake_certs management command. """ diff --git a/lms/djangoapps/certificates/tests/test_models.py b/lms/djangoapps/certificates/tests/test_models.py index e856984193..2829806a92 100644 --- a/lms/djangoapps/certificates/tests/test_models.py +++ b/lms/djangoapps/certificates/tests/test_models.py @@ -3,6 +3,7 @@ from django.conf import settings from django.core.exceptions import ValidationError from django.test import TestCase from django.test.utils import override_settings +from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from certificates.models import ( @@ -15,6 +16,7 @@ FEATURES_INVALID_FILE_PATH = settings.FEATURES.copy() FEATURES_INVALID_FILE_PATH['CERTS_HTML_VIEW_CONFIG_PATH'] = 'invalid/path/to/config.json' +@attr('shard_1') class ExampleCertificateTest(TestCase): """Tests for the ExampleCertificate model. """ @@ -80,6 +82,7 @@ class ExampleCertificateTest(TestCase): self.assertIs(result, None) +@attr('shard_1') class CertificateHtmlViewConfigurationTest(TestCase): """ Test the CertificateHtmlViewConfiguration model. diff --git a/lms/djangoapps/certificates/tests/test_queue.py b/lms/djangoapps/certificates/tests/test_queue.py index ee1843e739..a644aee5f2 100644 --- a/lms/djangoapps/certificates/tests/test_queue.py +++ b/lms/djangoapps/certificates/tests/test_queue.py @@ -3,6 +3,7 @@ from contextlib import contextmanager import json from mock import patch, Mock +from nose.plugins.attrib import attr from django.test import TestCase from django.test.utils import override_settings @@ -24,6 +25,7 @@ from certificates.queue import XQueueCertInterface from certificates.models import ExampleCertificateSet, ExampleCertificate +@attr('shard_1') @override_settings(CERT_QUEUE='certificates') class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase): """Test the "add to queue" operation of the XQueue interface. """ @@ -53,6 +55,7 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase): self.assertIn('https://edx.org/update_certificate?key=', actual_header['lms_callback_url']) +@attr('shard_1') @override_settings(CERT_QUEUE='certificates') class XQueueCertInterfaceExampleCertificateTest(TestCase): """Tests for the XQueue interface for certificate generation. """ diff --git a/lms/djangoapps/certificates/tests/test_resubmit_error_certificates.py b/lms/djangoapps/certificates/tests/test_resubmit_error_certificates.py index 564b02a968..d4e435cdbb 100644 --- a/lms/djangoapps/certificates/tests/test_resubmit_error_certificates.py +++ b/lms/djangoapps/certificates/tests/test_resubmit_error_certificates.py @@ -1,6 +1,7 @@ """Tests for the resubmit_error_certificates management command. """ import ddt from django.core.management.base import CommandError +from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -10,6 +11,7 @@ from certificates.management.commands import resubmit_error_certificates from certificates.models import GeneratedCertificate, CertificateStatuses +@attr('shard_1') @ddt.ddt class ResubmitErrorCertificatesTest(ModuleStoreTestCase): """Tests for the resubmit_error_certificates management command. """ diff --git a/lms/djangoapps/certificates/tests/test_views.py b/lms/djangoapps/certificates/tests/test_views.py index 7e031b912c..cbcacb18ac 100644 --- a/lms/djangoapps/certificates/tests/test_views.py +++ b/lms/djangoapps/certificates/tests/test_views.py @@ -3,6 +3,7 @@ import json import ddt from uuid import uuid4 +from nose.plugins.attrib import attr from django.conf import settings from django.core.cache import cache @@ -26,6 +27,7 @@ FEATURES_WITH_CERTS_DISABLED = settings.FEATURES.copy() FEATURES_WITH_CERTS_DISABLED['CERTIFICATES_HTML_VIEW'] = False +@attr('shard_1') @ddt.ddt class UpdateExampleCertificateViewTest(TestCase): """Tests for the XQueue callback that updates example certificates. """ @@ -167,6 +169,7 @@ class UpdateExampleCertificateViewTest(TestCase): self.assertEqual(content['return_code'], 0) +@attr('shard_1') class CertificatesViewsTests(ModuleStoreTestCase): """ Tests for the manual refund page diff --git a/lms/djangoapps/certificates/tests/tests.py b/lms/djangoapps/certificates/tests/tests.py index ff6af69e1d..e5e5a9980c 100644 --- a/lms/djangoapps/certificates/tests/tests.py +++ b/lms/djangoapps/certificates/tests/tests.py @@ -4,6 +4,7 @@ Tests for the certificates models. from ddt import ddt, data, unpack from mock import patch from django.conf import settings +from nose.plugins.attrib import attr from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -24,6 +25,7 @@ from util.milestones_helpers import ( ) +@attr('shard_1') @ddt class CertificatesModelTest(ModuleStoreTestCase): """ diff --git a/lms/djangoapps/class_dashboard/tests/test_dashboard_data.py b/lms/djangoapps/class_dashboard/tests/test_dashboard_data.py index 3afd9a84fe..782a75a7bf 100644 --- a/lms/djangoapps/class_dashboard/tests/test_dashboard_data.py +++ b/lms/djangoapps/class_dashboard/tests/test_dashboard_data.py @@ -7,6 +7,7 @@ import json from django.core.urlresolvers import reverse from django.test.client import RequestFactory from mock import patch +from nose.plugins.attrib import attr from capa.tests.response_xml_factory import StringResponseXMLFactory from courseware.tests.factories import StudentModuleFactory @@ -26,6 +27,7 @@ from class_dashboard.views import has_instructor_access_for_class USER_COUNT = 11 +@attr('shard_1') class TestGetProblemGradeDistribution(ModuleStoreTestCase): """ Tests related to class_dashboard/dashboard_data.py diff --git a/lms/djangoapps/class_dashboard/tests/test_views.py b/lms/djangoapps/class_dashboard/tests/test_views.py index 90de7c1f06..209ecb136a 100644 --- a/lms/djangoapps/class_dashboard/tests/test_views.py +++ b/lms/djangoapps/class_dashboard/tests/test_views.py @@ -5,6 +5,7 @@ import json from django.test.client import RequestFactory from mock import patch +from nose.plugins.attrib import attr from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -12,6 +13,7 @@ from class_dashboard import views from student.tests.factories import AdminFactory +@attr('shard_1') class TestViews(ModuleStoreTestCase): """ Tests related to class_dashboard/views.py diff --git a/lms/djangoapps/commerce/tests/test_views.py b/lms/djangoapps/commerce/tests/test_views.py index 1232f78c94..64399a9556 100644 --- a/lms/djangoapps/commerce/tests/test_views.py +++ b/lms/djangoapps/commerce/tests/test_views.py @@ -2,6 +2,7 @@ import json from uuid import uuid4 +from nose.plugins.attrib import attr from ddt import ddt, data from django.core.urlresolvers import reverse @@ -33,6 +34,7 @@ class UserMixin(object): self.client.login(username=self.user.username, password='test') +@attr('shard_1') @ddt @override_settings(ECOMMERCE_API_URL=TEST_API_URL, ECOMMERCE_API_SIGNING_KEY=TEST_API_SIGNING_KEY) class BasketsViewTests(EnrollmentEventTestMixin, UserMixin, ModuleStoreTestCase): @@ -303,6 +305,7 @@ class OrdersViewTests(BasketsViewTests): self.url = reverse('commerce:orders') +@attr('shard_1') @override_settings(ECOMMERCE_API_URL=TEST_API_URL, ECOMMERCE_API_SIGNING_KEY=TEST_API_SIGNING_KEY) class BasketOrderViewTests(UserMixin, TestCase): """ Tests for the basket order view. """ @@ -337,6 +340,7 @@ class BasketOrderViewTests(UserMixin, TestCase): self.assertEqual(response.status_code, 403) +@attr('shard_1') class ReceiptViewTests(TestCase): """ Tests for the receipt view. """ diff --git a/lms/djangoapps/course_wiki/tests/test_access.py b/lms/djangoapps/course_wiki/tests/test_access.py index aad975847f..c3a4a52d10 100644 --- a/lms/djangoapps/course_wiki/tests/test_access.py +++ b/lms/djangoapps/course_wiki/tests/test_access.py @@ -3,6 +3,7 @@ Tests for wiki permissions """ from django.contrib.auth.models import Group +from nose.plugins.attrib import attr from student.tests.factories import UserFactory from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -51,6 +52,7 @@ class TestWikiAccessBase(ModuleStoreTestCase): ] +@attr('shard_1') class TestWikiAccess(TestWikiAccessBase): """Test wiki access for course staff.""" def setUp(self): @@ -111,6 +113,7 @@ class TestWikiAccess(TestWikiAccessBase): self.assertFalse(user_is_article_course_staff(course_staff, self.wiki_310b.article)) +@attr('shard_1') class TestWikiAccessForStudent(TestWikiAccessBase): """Test access for students.""" def setUp(self): @@ -126,6 +129,7 @@ class TestWikiAccessForStudent(TestWikiAccessBase): self.assertFalse(user_is_article_course_staff(self.student, page.article)) +@attr('shard_1') class TestWikiAccessForNumericalCourseNumber(TestWikiAccessBase): """Test staff has access if course number is numerical and wiki slug has an underscore appended.""" def setUp(self): @@ -145,6 +149,7 @@ class TestWikiAccessForNumericalCourseNumber(TestWikiAccessBase): self.assertTrue(user_is_article_course_staff(course_staff, page.article)) +@attr('shard_1') class TestWikiAccessForOldFormatCourseStaffGroups(TestWikiAccessBase): """Test staff has access if course group has old format.""" def setUp(self): diff --git a/lms/djangoapps/course_wiki/tests/test_middleware.py b/lms/djangoapps/course_wiki/tests/test_middleware.py index 881a703132..494b0c4ff2 100644 --- a/lms/djangoapps/course_wiki/tests/test_middleware.py +++ b/lms/djangoapps/course_wiki/tests/test_middleware.py @@ -3,6 +3,7 @@ Tests for wiki middleware. """ from django.test.client import Client +from nose.plugins.attrib import attr from wiki.models import URLPath from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -12,6 +13,7 @@ from courseware.tests.factories import InstructorFactory from course_wiki.views import get_or_create_root +@attr('shard_1') class TestWikiAccessMiddleware(ModuleStoreTestCase): """Tests for WikiAccessMiddleware.""" diff --git a/lms/djangoapps/course_wiki/tests/tests.py b/lms/djangoapps/course_wiki/tests/tests.py index 03b8d097f0..323753c89a 100644 --- a/lms/djangoapps/course_wiki/tests/tests.py +++ b/lms/djangoapps/course_wiki/tests/tests.py @@ -1,4 +1,5 @@ from django.core.urlresolvers import reverse +from nose.plugins.attrib import attr from courseware.tests.tests import LoginEnrollmentTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -7,6 +8,7 @@ from xmodule.modulestore.tests.factories import CourseFactory from mock import patch +@attr('shard_1') class WikiRedirectTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Tests for wiki course redirection. diff --git a/lms/djangoapps/courseware/management/commands/tests/test_clean_history.py b/lms/djangoapps/courseware/management/commands/tests/test_clean_history.py index cf12feab60..01026751c0 100644 --- a/lms/djangoapps/courseware/management/commands/tests/test_clean_history.py +++ b/lms/djangoapps/courseware/management/commands/tests/test_clean_history.py @@ -2,6 +2,7 @@ import fnmatch from mock import Mock +from nose.plugins.attrib import attr import os.path import textwrap @@ -138,6 +139,7 @@ class HistoryCleanerTest(TransactionTestCase): self.assertEqual(self.parse_rows(rows), self.read_history()) +@attr('shard_1') class HistoryCleanerNoDbTest(HistoryCleanerTest): """Tests of StudentModuleHistoryCleaner with db access mocked.""" @@ -208,6 +210,7 @@ class HistoryCleanerNoDbTest(HistoryCleanerTest): smhc.delete_history.assert_called_once_with([42, 23, 15, 8]) +@attr('shard_1') class HistoryCleanerWitDbTest(HistoryCleanerTest): """Tests of StudentModuleHistoryCleaner with a real db.""" @@ -394,6 +397,7 @@ class SmhcForTestingMain(SmhcSayStubbed): self.say("(not really committing)") +@attr('shard_1') class HistoryCleanerMainTest(HistoryCleanerTest): """Tests of StudentModuleHistoryCleaner.main(), using SmhcForTestingMain.""" diff --git a/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py b/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py index ef97b66e0b..9a04bb2505 100644 --- a/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py +++ b/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py @@ -3,6 +3,7 @@ """Tests for Django management commands""" import json +from nose.plugins.attrib import attr from path import path import shutil from StringIO import StringIO @@ -35,6 +36,7 @@ TEST_DATA_MIXED_XML_MODULESTORE = mixed_store_config( ) +@attr('shard_1') class CommandsTestBase(ModuleStoreTestCase): """ Base class for testing different django commands. diff --git a/lms/djangoapps/courseware/tests/test_about.py b/lms/djangoapps/courseware/tests/test_about.py index d2a171548e..6d19bccc4a 100644 --- a/lms/djangoapps/courseware/tests/test_about.py +++ b/lms/djangoapps/courseware/tests/test_about.py @@ -8,6 +8,7 @@ from django.conf import settings from django.core.urlresolvers import reverse from django.test.utils import override_settings from mock import patch +from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey from course_modes.models import CourseMode @@ -32,6 +33,7 @@ REG_STR = "
$10', resp.content) +@attr('shard_1') @patch.dict(settings.FEATURES, {'ENABLE_SHOPPING_CART': True}) @patch.dict(settings.FEATURES, {'ENABLE_PAID_COURSE_REGISTRATION': True}) class AboutPurchaseCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): diff --git a/lms/djangoapps/courseware/tests/test_access.py b/lms/djangoapps/courseware/tests/test_access.py index b85fb049fa..8b7fdf46c5 100644 --- a/lms/djangoapps/courseware/tests/test_access.py +++ b/lms/djangoapps/courseware/tests/test_access.py @@ -4,6 +4,7 @@ import pytz from django.test import TestCase from django.core.urlresolvers import reverse from mock import Mock, patch +from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey import courseware.access as access @@ -28,6 +29,7 @@ from util.milestones_helpers import ( # pylint: disable=protected-access +@attr('shard_1') class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Tests for the various access controls on the student dashboard @@ -368,6 +370,7 @@ class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): self.assertEqual(response.status_code, 200) +@attr('shard_1') class UserRoleTestCase(TestCase): """ Tests for user roles. diff --git a/lms/djangoapps/courseware/tests/test_course_info.py b/lms/djangoapps/courseware/tests/test_course_info.py index dc9ba0ff37..857c4f4f82 100644 --- a/lms/djangoapps/courseware/tests/test_course_info.py +++ b/lms/djangoapps/courseware/tests/test_course_info.py @@ -2,6 +2,7 @@ Test the course_info xblock """ import mock +from nose.plugins.attrib import attr from django.core.urlresolvers import reverse from opaque_keys.edx.locations import SlashSeparatedCourseKey @@ -14,6 +15,7 @@ from student.models import CourseEnrollment from .helpers import LoginEnrollmentTestCase +@attr('shard_1') class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Tests for the Course Info page @@ -61,6 +63,7 @@ class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): self.assertFalse(enrollment_exists) +@attr('shard_1') class CourseInfoTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Tests for the Course Info page for an XML course diff --git a/lms/djangoapps/courseware/tests/test_course_survey.py b/lms/djangoapps/courseware/tests/test_course_survey.py index 72328245f4..a4ddf7b69a 100644 --- a/lms/djangoapps/courseware/tests/test_course_survey.py +++ b/lms/djangoapps/courseware/tests/test_course_survey.py @@ -3,6 +3,7 @@ Python tests for the Survey workflows """ from collections import OrderedDict +from nose.plugins.attrib import attr from django.core.urlresolvers import reverse @@ -13,6 +14,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from courseware.tests.helpers import LoginEnrollmentTestCase +@attr('shard_1') class SurveyViewsTests(LoginEnrollmentTestCase, ModuleStoreTestCase): """ All tests for the views.py file diff --git a/lms/djangoapps/courseware/tests/test_courses.py b/lms/djangoapps/courseware/tests/test_courses.py index 17211f4f56..ee7e978998 100644 --- a/lms/djangoapps/courseware/tests/test_courses.py +++ b/lms/djangoapps/courseware/tests/test_courses.py @@ -5,6 +5,7 @@ Tests for course access import ddt import itertools import mock +from nose.plugins.attrib import attr from django.conf import settings from django.test.utils import override_settings @@ -34,6 +35,7 @@ CMS_BASE_TEST = 'testcms' TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT +@attr('shard_1') class CoursesTest(ModuleStoreTestCase): """Test methods related to fetching courses.""" @@ -52,6 +54,7 @@ class CoursesTest(ModuleStoreTestCase): self.assertEqual(cms_url, get_cms_block_link(self.course, 'course')) +@attr('shard_1') class ModuleStoreBranchSettingTest(ModuleStoreTestCase): """Test methods related to the modulestore branch setting.""" @mock.patch( @@ -77,6 +80,7 @@ class ModuleStoreBranchSettingTest(ModuleStoreTestCase): self.assertEqual(_get_modulestore_branch_setting(), 'fake_default_branch') +@attr('shard_1') @override_settings(CMS_BASE=CMS_BASE_TEST) class MongoCourseImageTestCase(ModuleStoreTestCase): """Tests for course image URLs when using a mongo modulestore.""" @@ -132,6 +136,7 @@ class MongoCourseImageTestCase(ModuleStoreTestCase): ) +@attr('shard_1') class XmlCourseImageTestCase(XModuleXmlImportTest): """Tests for course image URLs when using an xml modulestore.""" @@ -149,6 +154,7 @@ class XmlCourseImageTestCase(XModuleXmlImportTest): self.assertEquals(course_image_url(course), u'/static/xml_test_course/before after.jpg') +@attr('shard_1') class CoursesRenderTest(ModuleStoreTestCase): """Test methods related to rendering courses content.""" @@ -196,6 +202,7 @@ class CoursesRenderTest(ModuleStoreTestCase): self.assertIn("this module is temporarily unavailable", course_about) +@attr('shard_1') class XmlCoursesRenderTest(ModuleStoreTestCase): """Test methods related to rendering courses content for an XML course.""" MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE @@ -219,6 +226,7 @@ class XmlCoursesRenderTest(ModuleStoreTestCase): self.assertIn("this module is temporarily unavailable", course_info) +@attr('shard_1') @ddt.ddt class CourseInstantiationTests(ModuleStoreTestCase): """ diff --git a/lms/djangoapps/courseware/tests/test_draft_modulestore.py b/lms/djangoapps/courseware/tests/test_draft_modulestore.py index f58795a5a0..0f0c5d3d0d 100644 --- a/lms/djangoapps/courseware/tests/test_draft_modulestore.py +++ b/lms/djangoapps/courseware/tests/test_draft_modulestore.py @@ -1,9 +1,11 @@ from django.test import TestCase +from nose.plugins.attrib import attr from xmodule.modulestore.django import modulestore from opaque_keys.edx.locations import SlashSeparatedCourseKey +@attr('shard_1') class TestDraftModuleStore(TestCase): """ Test the draft modulestore diff --git a/lms/djangoapps/courseware/tests/test_entrance_exam.py b/lms/djangoapps/courseware/tests/test_entrance_exam.py index 6b6f0e1b1b..f371d8d766 100644 --- a/lms/djangoapps/courseware/tests/test_entrance_exam.py +++ b/lms/djangoapps/courseware/tests/test_entrance_exam.py @@ -4,6 +4,7 @@ Tests use cases related to LMS Entrance Exam behavior, such as gated content acc from django.conf import settings from django.test.client import RequestFactory from django.core.urlresolvers import reverse +from nose.plugins.attrib import attr from courseware.model_data import FieldDataCache from courseware.module_render import get_module, toc_for_course @@ -34,6 +35,7 @@ from mock import patch, Mock import mock +@attr('shard_1') class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Check that content is properly gated. Create a test course from scratch to mess with. diff --git a/lms/djangoapps/courseware/tests/test_favicon.py b/lms/djangoapps/courseware/tests/test_favicon.py index d1c1e0570b..243b689d84 100644 --- a/lms/djangoapps/courseware/tests/test_favicon.py +++ b/lms/djangoapps/courseware/tests/test_favicon.py @@ -5,10 +5,12 @@ from django.test import TestCase from django.test.utils import override_settings from mock import patch +from nose.plugins.attrib import attr import sys +@attr('shard_1') class FaviconTestCase(TestCase): def setUp(self): diff --git a/lms/djangoapps/courseware/tests/test_field_overrides.py b/lms/djangoapps/courseware/tests/test_field_overrides.py index 1504be6d48..ed74c5c605 100644 --- a/lms/djangoapps/courseware/tests/test_field_overrides.py +++ b/lms/djangoapps/courseware/tests/test_field_overrides.py @@ -2,6 +2,7 @@ Tests for `field_overrides` module. """ import unittest +from nose.plugins.attrib import attr from django.test import TestCase from django.test.utils import override_settings @@ -18,6 +19,7 @@ from ..field_overrides import ( TESTUSER = "testuser" +@attr('shard_1') @override_settings(FIELD_OVERRIDE_PROVIDERS=( 'courseware.tests.test_field_overrides.TestOverrideProvider',)) class OverrideFieldDataTests(TestCase): @@ -89,6 +91,7 @@ class OverrideFieldDataTests(TestCase): self.assertIsInstance(data, DictFieldData) +@attr('shard_1') class ResolveDottedTests(unittest.TestCase): """ Tests for `resolve_dotted`. diff --git a/lms/djangoapps/courseware/tests/test_footer.py b/lms/djangoapps/courseware/tests/test_footer.py index f504abb9cb..edd873de54 100644 --- a/lms/djangoapps/courseware/tests/test_footer.py +++ b/lms/djangoapps/courseware/tests/test_footer.py @@ -4,12 +4,14 @@ edx.org uses an edx footer but other instances use an Open edX footer. """ from mock import patch +from nose.plugins.attrib import attr from django.conf import settings from django.test import TestCase from django.test.utils import override_settings +@attr('shard_1') class TestFooter(TestCase): SOCIAL_MEDIA_URLS = { diff --git a/lms/djangoapps/courseware/tests/test_grades.py b/lms/djangoapps/courseware/tests/test_grades.py index cecd0acc59..c6825c99be 100644 --- a/lms/djangoapps/courseware/tests/test_grades.py +++ b/lms/djangoapps/courseware/tests/test_grades.py @@ -3,6 +3,7 @@ Test grade calculation. """ from django.http import Http404 from mock import patch +from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey from courseware.grades import grade, iterate_grades_for @@ -25,6 +26,7 @@ def _grade_with_errors(student, request, course, keep_raw_scores=False): return grade(student, request, course, keep_raw_scores=keep_raw_scores) +@attr('shard_1') class TestGradeIteration(ModuleStoreTestCase): """ Test iteration through student gradesets. diff --git a/lms/djangoapps/courseware/tests/test_group_access.py b/lms/djangoapps/courseware/tests/test_group_access.py index 02174634e8..65554b792c 100644 --- a/lms/djangoapps/courseware/tests/test_group_access.py +++ b/lms/djangoapps/courseware/tests/test_group_access.py @@ -4,6 +4,7 @@ access control rules. """ import ddt +from nose.plugins.attrib import attr from stevedore.extension import Extension, ExtensionManager from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -50,6 +51,7 @@ def resolve_attrs(test_method): return _wrapper +@attr('shard_1') @ddt.ddt class GroupAccessTestCase(ModuleStoreTestCase): """ diff --git a/lms/djangoapps/courseware/tests/test_i18n.py b/lms/djangoapps/courseware/tests/test_i18n.py index 0e7888484a..e1f2503c32 100644 --- a/lms/djangoapps/courseware/tests/test_i18n.py +++ b/lms/djangoapps/courseware/tests/test_i18n.py @@ -2,11 +2,13 @@ Tests i18n in courseware """ import re +from nose.plugins.attrib import attr from django.test import TestCase from django.test.utils import override_settings +@attr('shard_1') @override_settings(LANGUAGES=(('eo', 'Esperanto'),)) class I18nTestCase(TestCase): """ diff --git a/lms/djangoapps/courseware/tests/test_lti_integration.py b/lms/djangoapps/courseware/tests/test_lti_integration.py index 8b5431f124..91d9867b85 100644 --- a/lms/djangoapps/courseware/tests/test_lti_integration.py +++ b/lms/djangoapps/courseware/tests/test_lti_integration.py @@ -3,6 +3,7 @@ from collections import OrderedDict import json import mock +from nose.plugins.attrib import attr import oauthlib import urllib @@ -17,6 +18,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.x_module import STUDENT_VIEW +@attr('shard_1') class TestLTI(BaseTestXmodule): """ Integration test for lti xmodule. @@ -122,6 +124,7 @@ class TestLTI(BaseTestXmodule): self.assertEqual(generated_content, expected_content) +@attr('shard_1') class TestLTIModuleListing(ModuleStoreTestCase): """ a test for the rest endpoint that lists LTI modules in a course diff --git a/lms/djangoapps/courseware/tests/test_masquerade.py b/lms/djangoapps/courseware/tests/test_masquerade.py index c86adb6a62..ce6dc156b7 100644 --- a/lms/djangoapps/courseware/tests/test_masquerade.py +++ b/lms/djangoapps/courseware/tests/test_masquerade.py @@ -3,6 +3,7 @@ Unit tests for masquerade. """ import json from mock import patch +from nose.plugins.attrib import attr from datetime import datetime from django.core.urlresolvers import reverse @@ -121,6 +122,7 @@ class MasqueradeTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertEqual(show_answer_expected, "Show Answer" in problem_html) +@attr('shard_1') class NormalStudentVisibilityTest(MasqueradeTestCase): """ Verify the course displays as expected for a "normal" student (to ensure test setup is correct). @@ -175,6 +177,7 @@ class StaffMasqueradeTestCase(MasqueradeTestCase): return response +@attr('shard_1') class TestStaffMasqueradeAsStudent(StaffMasqueradeTestCase): """ Check for staff being able to masquerade as student. @@ -212,6 +215,7 @@ class TestStaffMasqueradeAsStudent(StaffMasqueradeTestCase): self.verify_show_answer_present(True) +@attr('shard_1') class TestGetMasqueradingGroupId(StaffMasqueradeTestCase): """ Check for staff being able to masquerade as belonging to a group. diff --git a/lms/djangoapps/courseware/tests/test_microsites.py b/lms/djangoapps/courseware/tests/test_microsites.py index 68692c9ad7..fcf55f4809 100644 --- a/lms/djangoapps/courseware/tests/test_microsites.py +++ b/lms/djangoapps/courseware/tests/test_microsites.py @@ -4,6 +4,7 @@ Tests related to the Microsites feature from django.conf import settings from django.core.urlresolvers import reverse from django.test.utils import override_settings +from nose.plugins.attrib import attr from courseware.tests.helpers import LoginEnrollmentTestCase from course_modes.models import CourseMode @@ -13,6 +14,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase +@attr('shard_1') class TestMicrosites(ModuleStoreTestCase, LoginEnrollmentTestCase): """ This is testing of the Microsite feature diff --git a/lms/djangoapps/courseware/tests/test_middleware.py b/lms/djangoapps/courseware/tests/test_middleware.py index eb02a8709a..63adce0684 100644 --- a/lms/djangoapps/courseware/tests/test_middleware.py +++ b/lms/djangoapps/courseware/tests/test_middleware.py @@ -6,6 +6,7 @@ from django.core.urlresolvers import reverse from django.test.client import RequestFactory from django.http import Http404 from mock import patch +from nose.plugins.attrib import attr import courseware.courses as courses from courseware.middleware import RedirectUnenrolledMiddleware @@ -13,6 +14,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory +@attr('shard_1') class CoursewareMiddlewareTestCase(ModuleStoreTestCase): """Tests that courseware middleware is correctly redirected""" diff --git a/lms/djangoapps/courseware/tests/test_model_data.py b/lms/djangoapps/courseware/tests/test_model_data.py index 99e2f538ab..ca62da4e80 100644 --- a/lms/djangoapps/courseware/tests/test_model_data.py +++ b/lms/djangoapps/courseware/tests/test_model_data.py @@ -3,6 +3,7 @@ Test for lms courseware app, module data (runtime data storage for XBlocks) """ import json from mock import Mock, patch +from nose.plugins.attrib import attr from functools import partial from courseware.model_data import DjangoKeyValueStore @@ -52,6 +53,7 @@ class StudentModuleFactory(cmfStudentModuleFactory): course_id = course_id +@attr('shard_1') class TestInvalidScopes(TestCase): def setUp(self): super(TestInvalidScopes, self).setUp() @@ -72,6 +74,7 @@ class TestInvalidScopes(TestCase): self.assertRaises(InvalidScopeError, self.kvs.set_many, {key: 'value'}) +@attr('shard_1') class OtherUserFailureTestMixin(object): """ Mixin class to add test cases for failures when a user trying to use the kvs is not @@ -96,6 +99,7 @@ class OtherUserFailureTestMixin(object): self.kvs.set(self.other_key_factory(self.existing_field_name), "new_value") +@attr('shard_1') class TestStudentModuleStorage(OtherUserFailureTestMixin, TestCase): """Tests for user_state storage via StudentModule""" other_key_factory = partial(DjangoKeyValueStore.Key, Scope.user_state, 2, location('usage_id')) # user_id=2, not 1 @@ -206,6 +210,7 @@ class TestStudentModuleStorage(OtherUserFailureTestMixin, TestCase): self.assertEquals(len(exception_context.exception.saved_field_names), 0) +@attr('shard_1') class TestMissingStudentModule(TestCase): def setUp(self): super(TestMissingStudentModule, self).setUp() @@ -253,6 +258,7 @@ class TestMissingStudentModule(TestCase): self.assertFalse(self.kvs.has(user_state_key('a_field'))) +@attr('shard_1') class StorageTestBase(object): """ A base class for that gets subclassed when testing each of the scopes. diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index 3064b5356c..c3c97b3ce5 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -5,6 +5,7 @@ Test for lms courseware app, module render unit import ddt import itertools import json +from nose.plugins.attrib import attr from functools import partial from bson import ObjectId @@ -74,6 +75,7 @@ class EmptyXModuleDescriptor(XModuleDescriptor): # pylint: disable=abstract-met module_class = EmptyXModule +@attr('shard_1') @ddt.ddt class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase): """ @@ -258,6 +260,7 @@ class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertEqual(hash_resource(resources), 'a76e27c8e80ca3efd7ce743093aa59e0') +@attr('shard_1') class TestHandleXBlockCallback(ModuleStoreTestCase, LoginEnrollmentTestCase): """ Test the handle_xblock_callback function @@ -435,6 +438,7 @@ class TestHandleXBlockCallback(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertEquals(len(doc('div.xblock-student_view-videosequence')), 1) +@attr('shard_1') @ddt.ddt class TestTOC(ModuleStoreTestCase): """Check the Table of Contents for a course""" @@ -531,6 +535,7 @@ class TestTOC(ModuleStoreTestCase): self.assertIn(toc_section, actual) +@attr('shard_1') @ddt.ddt class TestHtmlModifiers(ModuleStoreTestCase): """ @@ -692,6 +697,7 @@ class XBlockWithJsonInitData(XBlock): return frag +@attr('shard_1') @ddt.ddt class JsonInitDataTest(ModuleStoreTestCase): """Tests for JSON data injected into the JS init function.""" @@ -785,6 +791,7 @@ class ViewInStudioTest(ModuleStoreTestCase): self.module = self._get_module(course_key, descriptor, location) +@attr('shard_1') class MongoViewInStudioTest(ViewInStudioTest): """Test the 'View in Studio' link visibility in a mongo backed course.""" @@ -813,6 +820,7 @@ class MongoViewInStudioTest(ViewInStudioTest): self.assertNotIn('View Unit in Studio', result_fragment.content) +@attr('shard_1') class MixedViewInStudioTest(ViewInStudioTest): """Test the 'View in Studio' link visibility in a mixed mongo backed course.""" @@ -837,6 +845,7 @@ class MixedViewInStudioTest(ViewInStudioTest): self.assertNotIn('View Unit in Studio', result_fragment.content) +@attr('shard_1') class XmlViewInStudioTest(ViewInStudioTest): """Test the 'View in Studio' link visibility in an xml backed course.""" MODULESTORE = TEST_DATA_XML_MODULESTORE @@ -848,6 +857,7 @@ class XmlViewInStudioTest(ViewInStudioTest): self.assertNotIn('View Unit in Studio', result_fragment.content) +@attr('shard_1') @patch.dict('django.conf.settings.FEATURES', {'DISPLAY_DEBUG_INFO_TO_STAFF': True, 'DISPLAY_HISTOGRAMS_TO_STAFF': True}) @patch('courseware.module_render.has_access', Mock(return_value=True)) class TestStaffDebugInfo(ModuleStoreTestCase): @@ -968,6 +978,7 @@ PER_STUDENT_ANONYMIZED_DESCRIPTORS = set( ) +@attr('shard_1') @ddt.ddt class TestAnonymousStudentId(ModuleStoreTestCase, LoginEnrollmentTestCase): """ @@ -1043,6 +1054,7 @@ class TestAnonymousStudentId(ModuleStoreTestCase, LoginEnrollmentTestCase): ) +@attr('shard_1') @patch('track.views.tracker') class TestModuleTrackingContext(ModuleStoreTestCase): """ @@ -1121,6 +1133,7 @@ class TestModuleTrackingContext(ModuleStoreTestCase): self.assertEqual(module_info['original_usage_version'], unicode(original_usage_version)) +@attr('shard_1') class TestXmoduleRuntimeEvent(TestSubmittingProblems): """ Inherit from TestSubmittingProblems to get functionality that set up a course and problems structure @@ -1169,6 +1182,7 @@ class TestXmoduleRuntimeEvent(TestSubmittingProblems): self.assertIsNone(student_module.max_grade) +@attr('shard_1') class TestRebindModule(TestSubmittingProblems): """ Tests to verify the functionality of rebinding a module. @@ -1235,6 +1249,7 @@ class TestRebindModule(TestSubmittingProblems): self.assertFalse(psycho_handler.called) +@attr('shard_1') @ddt.ddt class TestEventPublishing(ModuleStoreTestCase, LoginEnrollmentTestCase): """ @@ -1273,6 +1288,7 @@ class TestEventPublishing(ModuleStoreTestCase, LoginEnrollmentTestCase): mock_track_function.return_value.assert_called_once_with(event_type, event) +@attr('shard_1') @ddt.ddt class LMSXBlockServiceBindingTest(ModuleStoreTestCase): """ @@ -1355,6 +1371,7 @@ BLOCK_TYPES = ['xblock', 'xmodule'] USER_NUMBERS = range(2) +@attr('shard_1') @ddt.ddt class TestFilteredChildren(ModuleStoreTestCase): """ diff --git a/lms/djangoapps/courseware/tests/test_navigation.py b/lms/djangoapps/courseware/tests/test_navigation.py index 89637722be..492b94460b 100644 --- a/lms/djangoapps/courseware/tests/test_navigation.py +++ b/lms/djangoapps/courseware/tests/test_navigation.py @@ -2,6 +2,7 @@ This test file will run through some LMS test scenarios regarding access and navigation of the LMS """ import time +from nose.plugins.attrib import attr from django.conf import settings from django.core.urlresolvers import reverse @@ -13,6 +14,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory +@attr('shard_1') class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase): """ Check that navigation state is saved properly. diff --git a/lms/djangoapps/courseware/tests/test_password_history.py b/lms/djangoapps/courseware/tests/test_password_history.py index 69607ca0b4..6408fa90ed 100644 --- a/lms/djangoapps/courseware/tests/test_password_history.py +++ b/lms/djangoapps/courseware/tests/test_password_history.py @@ -4,6 +4,7 @@ This file will test through the LMS some of the PasswordHistory features import json from mock import patch from uuid import uuid4 +from nose.plugins.attrib import attr from django.contrib.auth.models import User from django.utils import timezone @@ -20,6 +21,7 @@ from student.models import PasswordHistory from courseware.tests.helpers import LoginEnrollmentTestCase +@attr('shard_1') @patch.dict("django.conf.settings.FEATURES", {'ADVANCED_SECURITY': True}) class TestPasswordHistory(LoginEnrollmentTestCase): """ diff --git a/lms/djangoapps/courseware/tests/test_recommender.py b/lms/djangoapps/courseware/tests/test_recommender.py index b9762f2548..af832f9d71 100644 --- a/lms/djangoapps/courseware/tests/test_recommender.py +++ b/lms/djangoapps/courseware/tests/test_recommender.py @@ -7,6 +7,7 @@ import itertools import StringIO from ddt import ddt, data from copy import deepcopy +from nose.plugins.attrib import attr from django.core.urlresolvers import reverse @@ -183,6 +184,7 @@ class TestRecommender(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assert_request_status_code(200, self.course_url) +@attr('shard_1') class TestRecommenderCreateFromEmpty(TestRecommender): """ Check whether we can add resources to an empty database correctly @@ -209,6 +211,7 @@ class TestRecommenderCreateFromEmpty(TestRecommender): self.assert_request_status_code(200, self.course_url) +@attr('shard_1') class TestRecommenderWithResources(TestRecommender): """ Check whether we can add/edit/flag/export resources correctly @@ -403,6 +406,7 @@ class TestRecommenderWithResources(TestRecommender): self.assert_request_status_code(200, self.course_url) +@attr('shard_1') @ddt class TestRecommenderVoteWithResources(TestRecommenderWithResources): """ @@ -520,6 +524,7 @@ class TestRecommenderVoteWithResources(TestRecommenderWithResources): self.check_event_response_by_key('handle_vote', resource, 'newVotes', test_case['new_votes']) +@attr('shard_1') @ddt class TestRecommenderStaffFeedbackWithResources(TestRecommenderWithResources): """ @@ -618,6 +623,7 @@ class TestRecommenderStaffFeedbackWithResources(TestRecommenderWithResources): self.check_event_response_by_http_status(test_case['handler'], resource, test_case['status']) +@attr('shard_1') @ddt class TestRecommenderFileUploading(TestRecommender): """ diff --git a/lms/djangoapps/courseware/tests/test_split_module.py b/lms/djangoapps/courseware/tests/test_split_module.py index c78b99db52..c1040d0540 100644 --- a/lms/djangoapps/courseware/tests/test_split_module.py +++ b/lms/djangoapps/courseware/tests/test_split_module.py @@ -3,6 +3,7 @@ Test for split test XModule """ from django.core.urlresolvers import reverse from mock import MagicMock +from nose.plugins.attrib import attr from courseware.module_render import get_module_for_descriptor from courseware.model_data import FieldDataCache @@ -13,6 +14,7 @@ from xmodule.partitions.partitions import Group, UserPartition from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory +@attr('shard_1') class SplitTestBase(ModuleStoreTestCase): """ Sets up a basic course and user for split test testing. @@ -268,6 +270,7 @@ class TestSplitTestVert(SplitTestBase): html1 = self._html(cond1vert, 1) +@attr('shard_1') class SplitTestPosition(ModuleStoreTestCase): """ Check that we can change positions in a course with partitions defined diff --git a/lms/djangoapps/courseware/tests/test_submitting_problems.py b/lms/djangoapps/courseware/tests/test_submitting_problems.py index dba21091f7..34fa3d8161 100644 --- a/lms/djangoapps/courseware/tests/test_submitting_problems.py +++ b/lms/djangoapps/courseware/tests/test_submitting_problems.py @@ -11,6 +11,7 @@ from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test.client import RequestFactory from mock import patch +from nose.plugins.attrib import attr from capa.tests.response_xml_factory import ( OptionResponseXMLFactory, CustomResponseXMLFactory, SchematicResponseXMLFactory, @@ -293,6 +294,7 @@ class TestSubmittingProblems(ModuleStoreTestCase, LoginEnrollmentTestCase): return [s.earned for s in hw_section['scores']] +@attr('shard_1') class TestCourseGrader(TestSubmittingProblems): """ Suite of tests for the course grader. @@ -593,6 +595,7 @@ class TestCourseGrader(TestSubmittingProblems): self.assertEqual(self.score_for_hw('homework3'), [1.0, 1.0]) +@attr('shard_1') class ProblemWithUploadedFilesTest(TestSubmittingProblems): """Tests of problems with uploaded files.""" @@ -645,6 +648,7 @@ class ProblemWithUploadedFilesTest(TestSubmittingProblems): self.assertItemsEqual(kwargs['files'].keys(), filenames.split()) +@attr('shard_1') class TestPythonGradedResponse(TestSubmittingProblems): """ Check that we can submit a schematic and custom response, and it answers properly. @@ -893,6 +897,7 @@ class TestPythonGradedResponse(TestSubmittingProblems): self._check_ireset(name) +@attr('shard_1') class TestAnswerDistributions(TestSubmittingProblems): """Check that we can pull answer distributions for problems.""" @@ -1048,6 +1053,7 @@ class TestAnswerDistributions(TestSubmittingProblems): ) +@attr('shard_1') class TestConditionalContent(TestSubmittingProblems): """ Check that conditional content works correctly with grading. diff --git a/lms/djangoapps/courseware/tests/test_tabs.py b/lms/djangoapps/courseware/tests/test_tabs.py index eb083f442c..704977f934 100644 --- a/lms/djangoapps/courseware/tests/test_tabs.py +++ b/lms/djangoapps/courseware/tests/test_tabs.py @@ -6,6 +6,7 @@ from django.conf import settings from django.core.urlresolvers import reverse from django.http import Http404 from mock import MagicMock, Mock, patch +from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey from courseware.courses import get_course_by_id @@ -24,6 +25,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory +@attr('shard_1') class StaticTabDateTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): """Test cases for Static Tab Dates.""" @@ -75,6 +77,7 @@ class StaticTabDateTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): self.assertIn("this module is temporarily unavailable", static_tab) +@attr('shard_1') class StaticTabDateTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Tests for the static tab dates of an XML course @@ -108,6 +111,7 @@ class StaticTabDateTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase): self.assertIn(self.xml_data, resp.content) +@attr('shard_1') class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Validate tab behavior when dealing with Entrance Exams @@ -214,6 +218,7 @@ class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): self.assertEqual(len(course_tab_list), 5) +@attr('shard_1') class TextBookTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Validate tab behavior when dealing with textbooks. diff --git a/lms/djangoapps/courseware/tests/test_video_handlers.py b/lms/djangoapps/courseware/tests/test_video_handlers.py index 581418f7df..d785136597 100644 --- a/lms/djangoapps/courseware/tests/test_video_handlers.py +++ b/lms/djangoapps/courseware/tests/test_video_handlers.py @@ -2,6 +2,7 @@ """Video xmodule tests in mongo.""" from mock import patch +from nose.plugins.attrib import attr import os import tempfile import textwrap @@ -103,6 +104,7 @@ def _upload_file(subs_file, location, filename): del_cached_content(content.location) +@attr('shard_1') class TestVideo(BaseTestXmodule): """Integration tests: web client + mongo.""" CATEGORY = "video" @@ -157,6 +159,7 @@ class TestVideo(BaseTestXmodule): super(TestVideo, self).tearDown() +@attr('shard_1') class TestTranscriptAvailableTranslationsDispatch(TestVideo): """ Test video handler that provide available translations info. @@ -216,6 +219,7 @@ class TestTranscriptAvailableTranslationsDispatch(TestVideo): self.assertEqual(json.loads(response.body), ['en', 'uk']) +@attr('shard_1') class TestTranscriptDownloadDispatch(TestVideo): """ Test video handler that provide translation transcripts. @@ -280,6 +284,7 @@ class TestTranscriptDownloadDispatch(TestVideo): self.assertEqual(response.headers['Content-Disposition'], 'attachment; filename="塞.srt"') +@attr('shard_1') class TestTranscriptTranslationGetDispatch(TestVideo): """ Test video handler that provide translation transcripts. @@ -485,6 +490,7 @@ class TestTranscriptTranslationGetDispatch(TestVideo): self.assertEqual(response.status, '404 Not Found') +@attr('shard_1') class TestStudioTranscriptTranslationGetDispatch(TestVideo): """ Test Studio video handler that provide translation transcripts. @@ -542,6 +548,7 @@ class TestStudioTranscriptTranslationGetDispatch(TestVideo): self.assertEqual(response.headers['Content-Language'], 'zh') +@attr('shard_1') class TestStudioTranscriptTranslationPostDispatch(TestVideo): """ Test Studio video handler that provide translation transcripts. @@ -602,6 +609,7 @@ class TestStudioTranscriptTranslationPostDispatch(TestVideo): self.assertTrue(_check_asset(self.item_descriptor.location, u'filename.srt')) +@attr('shard_1') class TestGetTranscript(TestVideo): """ Make sure that `get_transcript` method works correctly diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index 2bf2373ec9..438129ccac 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -5,6 +5,7 @@ from collections import OrderedDict from lxml import etree from mock import patch, MagicMock, Mock +from nose.plugins.attrib import attr from django.conf import settings from django.test import TestCase @@ -23,6 +24,7 @@ from .test_video_xml import SOURCE_XML from .test_video_handlers import TestVideo +@attr('shard_1') class TestVideoYouTube(TestVideo): METADATA = {} @@ -73,6 +75,7 @@ class TestVideoYouTube(TestVideo): ) +@attr('shard_1') class TestVideoNonYouTube(TestVideo): """Integration tests: web client + mongo.""" DATA = """ @@ -140,6 +143,7 @@ class TestVideoNonYouTube(TestVideo): ) +@attr('shard_1') class TestGetHtmlMethod(BaseTestXmodule): ''' Make sure that `get_html` works correctly. @@ -759,6 +763,7 @@ class TestGetHtmlMethod(BaseTestXmodule): ) +@attr('shard_1') class TestVideoDescriptorInitialization(BaseTestXmodule): """ Make sure that module initialization works correctly. @@ -829,6 +834,7 @@ class TestVideoDescriptorInitialization(BaseTestXmodule): self.assertFalse(self.item_descriptor.download_video) +@attr('shard_1') class VideoDescriptorTest(TestCase, VideoDescriptorTestBase): """ Tests for video descriptor that requires access to django settings. diff --git a/lms/djangoapps/courseware/tests/test_video_xml.py b/lms/djangoapps/courseware/tests/test_video_xml.py index fb82be1bf9..e7c5fafeeb 100644 --- a/lms/djangoapps/courseware/tests/test_video_xml.py +++ b/lms/djangoapps/courseware/tests/test_video_xml.py @@ -14,6 +14,7 @@ You can then use the CourseFactory and XModuleItemFactory as defined in common/lib/xmodule/xmodule/modulestore/tests/factories.py to create the course, section, subsection, unit, etc. """ +from nose.plugins.attrib import attr from xmodule.video_module import VideoDescriptor from xmodule.tests import LogicTest @@ -34,6 +35,7 @@ SOURCE_XML = """ """ +@attr('shard_1') class VideoModuleLogicTest(LogicTest): """Tests for logic of Video Xmodule.""" diff --git a/lms/djangoapps/courseware/tests/test_view_authentication.py b/lms/djangoapps/courseware/tests/test_view_authentication.py index dae2127faa..8d85111ed5 100644 --- a/lms/djangoapps/courseware/tests/test_view_authentication.py +++ b/lms/djangoapps/courseware/tests/test_view_authentication.py @@ -3,6 +3,7 @@ import pytz from django.core.urlresolvers import reverse from mock import patch +from nose.plugins.attrib import attr from courseware.access import has_access from courseware.tests.helpers import LoginEnrollmentTestCase @@ -20,6 +21,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from student.tests.factories import UserFactory, CourseEnrollmentFactory +@attr('shard_1') class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase): """ Check that view authentication works properly. @@ -386,6 +388,7 @@ class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertTrue(self.enroll(self.course)) +@attr('shard_1') class TestBetatesterAccess(ModuleStoreTestCase): """ Tests for the beta tester feature diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py index 55c2e2888c..ea7ad7517f 100644 --- a/lms/djangoapps/courseware/tests/test_views.py +++ b/lms/djangoapps/courseware/tests/test_views.py @@ -7,6 +7,7 @@ import ddt import json import unittest from datetime import datetime +from nose.plugins.attrib import attr from django.conf import settings from django.contrib.auth.models import AnonymousUser @@ -42,6 +43,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory +@attr('shard_1') class TestJumpTo(ModuleStoreTestCase): """ Check the jumpto link for a course. @@ -162,6 +164,7 @@ class TestJumpTo(ModuleStoreTestCase): self.assertEqual(response.status_code, 404) +@attr('shard_1') @ddt.ddt class ViewsTestCase(ModuleStoreTestCase): """ @@ -555,6 +558,7 @@ class ViewsTestCase(ModuleStoreTestCase): self.assertNotContains(response, checkbox_html, html=True) +@attr('shard_1') # setting TIME_ZONE_DISPLAYED_FOR_DEADLINES explicitly @override_settings(TIME_ZONE_DISPLAYED_FOR_DEADLINES="UTC") class BaseDueDateTests(ModuleStoreTestCase): @@ -672,6 +676,7 @@ class TestAccordionDueDate(BaseDueDateTests): ) +@attr('shard_1') class StartDateTests(ModuleStoreTestCase): """ Test that start dates are properly localized and displayed on the student @@ -727,6 +732,7 @@ class StartDateTests(ModuleStoreTestCase): self.assertIn("2015-JULY-17", text) +@attr('shard_1') @ddt.ddt class ProgressPageTests(ModuleStoreTestCase): """ @@ -808,6 +814,7 @@ class ProgressPageTests(ModuleStoreTestCase): self.assertNotContains(resp, 'Request Certificate') +@attr('shard_1') class VerifyCourseKeyDecoratorTests(TestCase): """ Tests for the ensure_valid_course_key decorator. @@ -833,6 +840,7 @@ class VerifyCourseKeyDecoratorTests(TestCase): self.assertFalse(mocked_view.called) +@attr('shard_1') class IsCoursePassedTests(ModuleStoreTestCase): """ Tests for the is_course_passed helper function @@ -867,6 +875,7 @@ class IsCoursePassedTests(ModuleStoreTestCase): self.assertFalse(views.is_course_passed(self.course, None, self.student, self.request)) +@attr('shard_1') class GenerateUserCertTests(ModuleStoreTestCase): """ Tests for the view function Generated User Certs @@ -1022,6 +1031,7 @@ class ViewCheckerBlock(XBlock): return result +@attr('shard_1') @ddt.ddt class TestIndexView(ModuleStoreTestCase): """ diff --git a/lms/djangoapps/courseware/tests/test_word_cloud.py b/lms/djangoapps/courseware/tests/test_word_cloud.py index 248a6593fd..5fbed4bf12 100644 --- a/lms/djangoapps/courseware/tests/test_word_cloud.py +++ b/lms/djangoapps/courseware/tests/test_word_cloud.py @@ -3,11 +3,13 @@ import json from operator import itemgetter +from nose.plugins.attrib import attr from . import BaseTestXmodule from xmodule.x_module import STUDENT_VIEW +@attr('shard_1') class TestWordCloud(BaseTestXmodule): """Integration test for word cloud xmodule.""" CATEGORY = "word_cloud" diff --git a/lms/djangoapps/courseware/tests/tests.py b/lms/djangoapps/courseware/tests/tests.py index f6c116cfd9..ac6e23aca2 100644 --- a/lms/djangoapps/courseware/tests/tests.py +++ b/lms/djangoapps/courseware/tests/tests.py @@ -6,6 +6,7 @@ from unittest import TestCase from django.core.urlresolvers import reverse import mock +from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey from courseware.tests.helpers import LoginEnrollmentTestCase @@ -17,6 +18,7 @@ from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase +@attr('shard_1') class ActivateLoginTest(LoginEnrollmentTestCase): """ Test logging in and logging out. @@ -112,6 +114,7 @@ class PageLoaderTestCase(LoginEnrollmentTestCase): self.assertNotIsInstance(descriptor, ErrorDescriptor) +@attr('shard_1') class TestXmlCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase): """ Check that all pages in test courses load properly from XML. @@ -129,6 +132,7 @@ class TestXmlCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase): self.check_all_pages_load(SlashSeparatedCourseKey('edX', 'toy', '2012_Fall')) +@attr('shard_1') class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase): """ Check that all pages in test courses load properly from Mongo. @@ -152,6 +156,7 @@ class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase): self.assertGreater(len(course.textbooks), 0) +@attr('shard_1') class TestDraftModuleStore(ModuleStoreTestCase): def test_get_items_with_course_items(self): store = modulestore() @@ -164,6 +169,7 @@ class TestDraftModuleStore(ModuleStoreTestCase): # not allowed to be passed in (i.e. was throwing exception) +@attr('shard_1') class TestLmsFieldData(TestCase): """ Tests of the LmsFieldData class diff --git a/lms/djangoapps/dashboard/tests/test_support.py b/lms/djangoapps/dashboard/tests/test_support.py index 408867fbc7..e2b7378768 100644 --- a/lms/djangoapps/dashboard/tests/test_support.py +++ b/lms/djangoapps/dashboard/tests/test_support.py @@ -5,6 +5,7 @@ import datetime from django.contrib.auth.models import Permission from django.test.client import Client +from nose.plugins.attrib import attr from course_modes.models import CourseMode from shoppingcart.models import CertificateItem, Order @@ -14,6 +15,7 @@ from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase +@attr('shard_1') class RefundTests(ModuleStoreTestCase): """ Tests for the manual refund page diff --git a/lms/djangoapps/dashboard/tests/test_sysadmin.py b/lms/djangoapps/dashboard/tests/test_sysadmin.py index 255f957a8b..735ffb29f6 100644 --- a/lms/djangoapps/dashboard/tests/test_sysadmin.py +++ b/lms/djangoapps/dashboard/tests/test_sysadmin.py @@ -7,6 +7,7 @@ import re import shutil import unittest from util.date_utils import get_time_display, DEFAULT_DATE_TIME_FORMAT +from nose.plugins.attrib import attr from django.conf import settings from django.contrib.auth.hashers import check_password @@ -115,6 +116,7 @@ class SysadminBaseTestCase(ModuleStoreTestCase): self.addCleanup(shutil.rmtree, path) +@attr('shard_1') @unittest.skipUnless(settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD'), "ENABLE_SYSADMIN_DASHBOARD not set") @override_settings(GIT_IMPORT_WITH_XMLMODULESTORE=True) @@ -404,6 +406,7 @@ class TestSysadmin(SysadminBaseTestCase): self._rm_edx4edx() +@attr('shard_1') @override_settings(MONGODB_LOG=TEST_MONGODB_LOG) @unittest.skipUnless(settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD'), "ENABLE_SYSADMIN_DASHBOARD not set") diff --git a/lms/djangoapps/django_comment_client/tests/test_middleware.py b/lms/djangoapps/django_comment_client/tests/test_middleware.py index 5d18fc55e1..1c7becaadc 100644 --- a/lms/djangoapps/django_comment_client/tests/test_middleware.py +++ b/lms/djangoapps/django_comment_client/tests/test_middleware.py @@ -1,11 +1,13 @@ import django.http from django.test import TestCase +from nose.plugins.attrib import attr import json import lms.lib.comment_client import django_comment_client.middleware as middleware +@attr('shard_1') class AjaxExceptionTestCase(TestCase): def setUp(self): super(AjaxExceptionTestCase, self).setUp() diff --git a/lms/djangoapps/django_comment_client/tests/test_models.py b/lms/djangoapps/django_comment_client/tests/test_models.py index 7c63808edd..e243f6d609 100644 --- a/lms/djangoapps/django_comment_client/tests/test_models.py +++ b/lms/djangoapps/django_comment_client/tests/test_models.py @@ -2,6 +2,7 @@ Tests for the django comment client integration models """ from django.test.testcases import TestCase +from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE @@ -9,6 +10,7 @@ import django_comment_common.models as models from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase +@attr('shard_1') class RoleClassTestCase(ModuleStoreTestCase): """ Tests for roles of the comment client service integration @@ -50,6 +52,7 @@ class RoleClassTestCase(ModuleStoreTestCase): self.TA_role_2.inherit_permissions(self.TA_role) +@attr('shard_1') class PermissionClassTestCase(TestCase): """ Tests for permissions of the comment client service integration diff --git a/lms/djangoapps/django_comment_client/tests/test_utils.py b/lms/djangoapps/django_comment_client/tests/test_utils.py index 81cff7d477..76c03a3e4f 100644 --- a/lms/djangoapps/django_comment_client/tests/test_utils.py +++ b/lms/djangoapps/django_comment_client/tests/test_utils.py @@ -2,6 +2,7 @@ import datetime import json import mock +from nose.plugins.attrib import attr from pytz import UTC from django.utils.timezone import UTC as django_utc @@ -24,6 +25,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase +@attr('shard_1') class DictionaryTestCase(TestCase): def test_extract(self): d = {'cats': 'meow', 'dogs': 'woof'} @@ -48,6 +50,7 @@ class DictionaryTestCase(TestCase): self.assertEqual(utils.merge_dict(d1, d2), expected) +@attr('shard_1') class AccessUtilsTestCase(ModuleStoreTestCase): """ Base testcase class for access and roles for the @@ -90,6 +93,7 @@ class AccessUtilsTestCase(ModuleStoreTestCase): self.assertFalse(ret) +@attr('shard_1') class CoursewareContextTestCase(ModuleStoreTestCase): """ Base testcase class for courseware context for the @@ -168,6 +172,7 @@ class CategoryMapTestMixin(object): ) +@attr('shard_1') class CategoryMapTestCase(CategoryMapTestMixin, ModuleStoreTestCase): """ Base testcase class for discussion categories for the @@ -759,6 +764,7 @@ class CategoryMapTestCase(CategoryMapTestMixin, ModuleStoreTestCase): ) +@attr('shard_1') class ContentGroupCategoryMapTestCase(CategoryMapTestMixin, ContentGroupTestCase): """ Tests `get_discussion_category_map` on discussion modules which are @@ -932,6 +938,7 @@ class JsonResponseTestCase(TestCase, UnicodeTestMixin): self.assertEqual(reparsed, text) +@attr('shard_1') class RenderMustacheTests(TestCase): """ Test the `render_mustache` utility function. diff --git a/lms/djangoapps/instructor/tests/test_access.py b/lms/djangoapps/instructor/tests/test_access.py index a22fe7f1ee..7ddbd7233e 100644 --- a/lms/djangoapps/instructor/tests/test_access.py +++ b/lms/djangoapps/instructor/tests/test_access.py @@ -3,6 +3,7 @@ Test instructor.access """ from nose.tools import raises +from nose.plugins.attrib import attr from student.tests.factories import UserFactory from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -17,6 +18,7 @@ from instructor.access import (allow_access, update_forum_role) +@attr('shard_1') class TestInstructorAccessList(ModuleStoreTestCase): """ Test access listings. """ def setUp(self): @@ -40,6 +42,7 @@ class TestInstructorAccessList(ModuleStoreTestCase): self.assertEqual(set(beta_testers), set(self.beta_testers)) +@attr('shard_1') class TestInstructorAccessAllow(ModuleStoreTestCase): """ Test access allow. """ def setUp(self): @@ -75,6 +78,7 @@ class TestInstructorAccessAllow(ModuleStoreTestCase): allow_access(self.course, user, 'staff') +@attr('shard_1') class TestInstructorAccessRevoke(ModuleStoreTestCase): """ Test access revoke. """ def setUp(self): @@ -110,6 +114,7 @@ class TestInstructorAccessRevoke(ModuleStoreTestCase): revoke_access(self.course, user, 'robot-not-a-level') +@attr('shard_1') class TestInstructorAccessForum(ModuleStoreTestCase): """ Test forum access control. diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py index 22333c0d15..b82aa88b81 100644 --- a/lms/djangoapps/instructor/tests/test_api.py +++ b/lms/djangoapps/instructor/tests/test_api.py @@ -27,6 +27,7 @@ from django.utils.translation import ugettext as _ from mock import Mock, patch from nose.tools import raises +from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey from course_modes.models import CourseMode @@ -107,6 +108,7 @@ def view_alreadyrunningerror(request): # pylint: disable=unused-argument raise AlreadyRunningError() +@attr('shard_1') class TestCommonExceptions400(TestCase): """ Testing the common_exceptions_400 decorator. @@ -148,6 +150,7 @@ class TestCommonExceptions400(TestCase): self.assertIn("Task is already running", result["error"]) +@attr('shard_1') @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message')) @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase): @@ -304,6 +307,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase): ) +@attr('shard_1') @patch.dict(settings.FEATURES, {'ALLOW_AUTOMATED_SIGNUPS': True}) class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase): """ @@ -560,6 +564,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, Log self.assertEquals(response.status_code, 403) +@attr('shard_1') @ddt.ddt class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase): """ @@ -1141,6 +1146,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase): return response +@attr('shard_1') @ddt.ddt class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase): """ @@ -1456,6 +1462,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe ) +@attr('shard_1') class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase): """ Test endpoints whereby instructors can change permissions @@ -1694,6 +1701,7 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase self.assertNotIn(rolename, user_roles) +@attr('shard_1') @ddt.ddt @patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True}) class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCase): @@ -2156,6 +2164,7 @@ class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCa self.assertEqual(response.status_code, 400) +@attr('shard_1') class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase): """ Test endpoints whereby instructors can change student grades. @@ -2317,6 +2326,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase) self.assertEqual(response.status_code, 400) +@attr('shard_1') @patch.dict(settings.FEATURES, {'ENTRANCE_EXAMS': True}) class TestEntranceExamInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase): """ @@ -2561,6 +2571,7 @@ class TestEntranceExamInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollm self.assertContains(response, message) +@attr('shard_1') @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message')) @patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False}) class TestInstructorSendEmail(ModuleStoreTestCase, LoginEnrollmentTestCase): @@ -2645,6 +2656,7 @@ class MockCompletionInfo(object): return False, 'Task Errored In Some Way' +@attr('shard_1') class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase): """ Test instructor task list endpoint. @@ -2803,6 +2815,7 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertEqual(actual_tasks, expected_tasks) +@attr('shard_1') @patch.object(instructor_task.api, 'get_instructor_task_history') class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCase): """ @@ -2933,6 +2946,7 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas self.assertDictEqual(expected_info, returned_info) +@attr('shard_1') @ddt.ddt @override_settings(ANALYTICS_SERVER_URL="http://robotanalyticsserver.netbot:900/") @override_settings(ANALYTICS_API_KEY="robot_api_key") @@ -3081,6 +3095,7 @@ class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCa self.assertFalse(act.called) +@attr('shard_1') class TestInstructorAPIHelpers(TestCase): """ Test helpers for instructor.api """ @@ -3134,6 +3149,7 @@ def get_extended_due(course, unit, user): return None +@attr('shard_1') class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase): """ Test data dumps for reporting. @@ -3322,6 +3338,7 @@ class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase): self.user1.profile.name, self.user1.username)}) +@attr('shard_1') @override_settings(REGISTRATION_CODE_LENGTH=8) class TestCourseRegistrationCodes(ModuleStoreTestCase): """ @@ -3773,6 +3790,7 @@ class TestCourseRegistrationCodes(ModuleStoreTestCase): self.assertTrue(body.startswith(EXPECTED_COUPON_CSV_HEADER)) +@attr('shard_1') class TestBulkCohorting(ModuleStoreTestCase): """ Test adding users to cohorts in bulk via CSV upload. diff --git a/lms/djangoapps/instructor/tests/test_api_email_localization.py b/lms/djangoapps/instructor/tests/test_api_email_localization.py index b78c71d3ce..6d39d5f057 100644 --- a/lms/djangoapps/instructor/tests/test_api_email_localization.py +++ b/lms/djangoapps/instructor/tests/test_api_email_localization.py @@ -5,6 +5,7 @@ Unit tests for the localization of emails sent by instructor.api methods. from django.core import mail from django.core.urlresolvers import reverse +from nose.plugins.attrib import attr from courseware.tests.factories import InstructorFactory from lang_pref import LANGUAGE_KEY @@ -15,6 +16,7 @@ from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase +@attr('shard_1') class TestInstructorAPIEnrollmentEmailLocalization(ModuleStoreTestCase): """ Test whether the enroll, unenroll and beta role emails are sent in the diff --git a/lms/djangoapps/instructor/tests/test_certificates.py b/lms/djangoapps/instructor/tests/test_certificates.py index 12509f4475..2220fd497c 100644 --- a/lms/djangoapps/instructor/tests/test_certificates.py +++ b/lms/djangoapps/instructor/tests/test_certificates.py @@ -2,6 +2,7 @@ import contextlib import ddt import mock +from nose.plugins.attrib import attr from django.core.urlresolvers import reverse from django.test.utils import override_settings from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -12,6 +13,7 @@ from certificates.models import CertificateGenerationConfiguration from certificates import api as certs_api +@attr('shard_1') @ddt.ddt class CertificatesInstructorDashTest(ModuleStoreTestCase): """Tests for the certificate panel of the instructor dash. """ @@ -148,6 +150,7 @@ class CertificatesInstructorDashTest(ModuleStoreTestCase): self.assertContains(response, expected_html) +@attr('shard_1') @override_settings(CERT_QUEUE='certificates') @ddt.ddt class CertificatesInstructorApiTest(ModuleStoreTestCase): diff --git a/lms/djangoapps/instructor/tests/test_ecommerce.py b/lms/djangoapps/instructor/tests/test_ecommerce.py index fc14454324..b09fae96d0 100644 --- a/lms/djangoapps/instructor/tests/test_ecommerce.py +++ b/lms/djangoapps/instructor/tests/test_ecommerce.py @@ -7,6 +7,7 @@ import datetime import pytz from django.core.urlresolvers import reverse +from nose.plugins.attrib import attr from course_modes.models import CourseMode from student.roles import CourseFinanceAdminRole @@ -16,6 +17,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory +@attr('shard_1') class TestECommerceDashboardViews(ModuleStoreTestCase): """ Check for E-commerce view on the new instructor dashboard diff --git a/lms/djangoapps/instructor/tests/test_email.py b/lms/djangoapps/instructor/tests/test_email.py index 2f3faac5de..d18e9f403a 100644 --- a/lms/djangoapps/instructor/tests/test_email.py +++ b/lms/djangoapps/instructor/tests/test_email.py @@ -7,6 +7,7 @@ that the view is conditionally available when Course Auth is turned on. from django.conf import settings from django.core.urlresolvers import reverse from mock import patch +from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey from bulk_email.models import CourseAuthorization @@ -15,6 +16,7 @@ from student.tests.factories import AdminFactory from xmodule.modulestore.tests.factories import CourseFactory +@attr('shard_1') class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase): """ Check for email view on the new instructor dashboard @@ -98,6 +100,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase): self.assertFalse(self.email_link in response.content) +@attr('shard_1') class TestNewInstructorDashboardEmailViewXMLBacked(ModuleStoreTestCase): """ Check for email view on the new instructor dashboard diff --git a/lms/djangoapps/instructor/tests/test_enrollment.py b/lms/djangoapps/instructor/tests/test_enrollment.py index fd36c37000..5db16a2ce8 100644 --- a/lms/djangoapps/instructor/tests/test_enrollment.py +++ b/lms/djangoapps/instructor/tests/test_enrollment.py @@ -11,6 +11,7 @@ from django.conf import settings from django.test import TestCase from django.utils.translation import get_language from django.utils.translation import override as override_language +from nose.plugins.attrib import attr from student.tests.factories import UserFactory from xmodule.modulestore.tests.factories import CourseFactory @@ -31,6 +32,7 @@ from student.models import anonymous_id_for_user from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase +@attr('shard_1') class TestSettableEnrollmentState(TestCase): """ Test the basis class for enrollment tests. """ def setUp(self): @@ -94,6 +96,7 @@ class TestEnrollmentChangeBase(TestCase): self.assertEqual(after, after_ideal) +@attr('shard_1') class TestInstructorEnrollDB(TestEnrollmentChangeBase): """ Test instructor.enrollment.enroll_email """ def test_enroll(self): @@ -211,6 +214,7 @@ class TestInstructorEnrollDB(TestEnrollmentChangeBase): return self._run_state_change_test(before_ideal, after_ideal, action) +@attr('shard_1') class TestInstructorUnenrollDB(TestEnrollmentChangeBase): """ Test instructor.enrollment.unenroll_email """ def test_unenroll(self): @@ -290,6 +294,7 @@ class TestInstructorUnenrollDB(TestEnrollmentChangeBase): return self._run_state_change_test(before_ideal, after_ideal, action) +@attr('shard_1') class TestInstructorEnrollmentStudentModule(TestCase): """ Test student module manipulations. """ def setUp(self): @@ -419,6 +424,7 @@ class SettableEnrollmentState(EmailEnrollmentState): return EnrollmentObjects(email, None, None, None) +@attr('shard_1') class TestSendBetaRoleEmail(TestCase): """ Test edge cases for `send_beta_role_email` @@ -436,6 +442,7 @@ class TestSendBetaRoleEmail(TestCase): send_beta_role_email(bad_action, self.user, self.email_params) +@attr('shard_1') class TestGetEmailParams(ModuleStoreTestCase): """ Test what URLs the function get_email_params returns under different @@ -480,6 +487,7 @@ class TestGetEmailParams(ModuleStoreTestCase): self.assertEqual(result['course_url'], self.course_url) +@attr('shard_1') class TestRenderMessageToString(ModuleStoreTestCase): """ Test that email templates can be rendered in a language chosen manually. diff --git a/lms/djangoapps/instructor/tests/test_hint_manager.py b/lms/djangoapps/instructor/tests/test_hint_manager.py index 77cb591cd2..5ce0e7e325 100644 --- a/lms/djangoapps/instructor/tests/test_hint_manager.py +++ b/lms/djangoapps/instructor/tests/test_hint_manager.py @@ -2,6 +2,7 @@ import json from django.test.client import Client, RequestFactory from mock import patch, MagicMock +from nose.plugins.attrib import attr from courseware.models import XModuleUserStateSummaryField from courseware.tests.factories import UserStateSummaryFactory @@ -13,6 +14,7 @@ from xmodule.modulestore.tests.factories import CourseFactory # pylint: disable=missing-docstring +@attr('shard_1') class HintManagerTest(ModuleStoreTestCase): def setUp(self): diff --git a/lms/djangoapps/instructor/tests/test_legacy_enrollment.py b/lms/djangoapps/instructor/tests/test_legacy_enrollment.py index 3eea58c28d..314185bcdd 100644 --- a/lms/djangoapps/instructor/tests/test_legacy_enrollment.py +++ b/lms/djangoapps/instructor/tests/test_legacy_enrollment.py @@ -5,6 +5,7 @@ Unit tests for enrollment methods in views.py import ddt from mock import patch +from nose.plugins.attrib import attr from django.contrib.auth.models import User from django.core.urlresolvers import reverse @@ -19,6 +20,7 @@ from django.core import mail USER_COUNT = 4 +@attr('shard_1') @ddt.ddt class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase): """ diff --git a/lms/djangoapps/instructor/tests/test_legacy_raw_download_csv.py b/lms/djangoapps/instructor/tests/test_legacy_raw_download_csv.py index 0dee6607c7..4f7cfdf9ed 100644 --- a/lms/djangoapps/instructor/tests/test_legacy_raw_download_csv.py +++ b/lms/djangoapps/instructor/tests/test_legacy_raw_download_csv.py @@ -5,11 +5,13 @@ Create course and answer a problem to test raw grade CSV from django.contrib.auth.models import User from django.core.urlresolvers import reverse +from nose.plugins.attrib import attr from courseware.tests.test_submitting_problems import TestSubmittingProblems from student.roles import CourseStaffRole +@attr('shard_1') class TestRawGradeCSV(TestSubmittingProblems): """ Tests around the instructor dashboard raw grade CSV diff --git a/lms/djangoapps/instructor/tests/test_legacy_xss.py b/lms/djangoapps/instructor/tests/test_legacy_xss.py index bfdd404e25..ff541ff69c 100644 --- a/lms/djangoapps/instructor/tests/test_legacy_xss.py +++ b/lms/djangoapps/instructor/tests/test_legacy_xss.py @@ -5,6 +5,7 @@ Tests of various instructor dashboard features that include lists of students from django.conf import settings from django.test.client import RequestFactory from markupsafe import escape +from nose.plugins.attrib import attr from student.tests.factories import UserFactory, CourseEnrollmentFactory from edxmako.tests import mako_middleware_process_request @@ -16,6 +17,7 @@ from instructor.views import legacy # pylint: disable=missing-docstring +@attr('shard_1') class TestXss(ModuleStoreTestCase): def setUp(self): super(TestXss, self).setUp() diff --git a/lms/djangoapps/instructor/tests/test_spoc_gradebook.py b/lms/djangoapps/instructor/tests/test_spoc_gradebook.py index ccb5088a0e..2e0ca99a73 100644 --- a/lms/djangoapps/instructor/tests/test_spoc_gradebook.py +++ b/lms/djangoapps/instructor/tests/test_spoc_gradebook.py @@ -3,6 +3,7 @@ Tests of the instructor dashboard spoc gradebook """ from django.core.urlresolvers import reverse +from nose.plugins.attrib import attr from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from student.tests.factories import UserFactory, CourseEnrollmentFactory, AdminFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -14,6 +15,7 @@ from xmodule.modulestore.django import modulestore USER_COUNT = 11 +@attr('shard_1') class TestGradebook(ModuleStoreTestCase): """ Test functionality of the spoc gradebook. Sets up a course with assignments and @@ -79,6 +81,7 @@ class TestGradebook(ModuleStoreTestCase): self.assertEquals(self.response.status_code, 200) +@attr('shard_1') class TestDefaultGradingPolicy(TestGradebook): """ Tests that the grading policy is properly applied for all users in the course @@ -104,6 +107,7 @@ class TestDefaultGradingPolicy(TestGradebook): self.assertEquals(293, self.response.content.count('grade_None')) +@attr('shard_1') class TestLetterCutoffPolicy(TestGradebook): """ Tests advanced grading policy (with letter grade cutoffs). Includes tests of diff --git a/lms/djangoapps/instructor/tests/test_tools.py b/lms/djangoapps/instructor/tests/test_tools.py index 17a08c72ed..69086fd78c 100644 --- a/lms/djangoapps/instructor/tests/test_tools.py +++ b/lms/djangoapps/instructor/tests/test_tools.py @@ -9,6 +9,7 @@ import unittest from django.utils.timezone import utc from django.test.utils import override_settings +from nose.plugins.attrib import attr from courseware.field_overrides import OverrideFieldData # pylint: disable=import-error from student.tests.factories import UserFactory # pylint: disable=import-error @@ -22,6 +23,7 @@ from ..views import tools DATE_FIELD = Date() +@attr('shard_1') class TestDashboardError(unittest.TestCase): """ Test DashboardError exceptions. @@ -32,6 +34,7 @@ class TestDashboardError(unittest.TestCase): self.assertEqual(response, {'error': 'Oh noes!'}) +@attr('shard_1') class TestHandleDashboardError(unittest.TestCase): """ Test handle_dashboard_error decorator. @@ -60,6 +63,7 @@ class TestHandleDashboardError(unittest.TestCase): self.assertEqual(view(None, None), "Oh yes!") +@attr('shard_1') class TestRequireStudentIdentifier(unittest.TestCase): """ Test require_student_from_identifier() @@ -82,6 +86,7 @@ class TestRequireStudentIdentifier(unittest.TestCase): tools.require_student_from_identifier("invalid") +@attr('shard_1') class TestParseDatetime(unittest.TestCase): """ Test date parsing. @@ -96,6 +101,7 @@ class TestParseDatetime(unittest.TestCase): tools.parse_datetime('foo') +@attr('shard_1') class TestFindUnit(ModuleStoreTestCase): """ Test the find_unit function. @@ -131,6 +137,7 @@ class TestFindUnit(ModuleStoreTestCase): tools.find_unit(self.course, url) +@attr('shard_1') class TestGetUnitsWithDueDate(ModuleStoreTestCase): """ Test the get_units_with_due_date function. @@ -166,6 +173,7 @@ class TestGetUnitsWithDueDate(ModuleStoreTestCase): urls((self.week1, self.week2))) +@attr('shard_1') class TestTitleOrUrl(unittest.TestCase): """ Test the title_or_url funciton. @@ -180,6 +188,7 @@ class TestTitleOrUrl(unittest.TestCase): self.assertEquals(tools.title_or_url(unit), 'test:hello') +@attr('shard_1') @override_settings( FIELD_OVERRIDE_PROVIDERS=( 'courseware.student_field_overrides.IndividualStudentOverrideProvider',), @@ -265,6 +274,7 @@ class TestSetDueDateExtension(ModuleStoreTestCase): self.assertEqual(self.week1.due, self.due) +@attr('shard_1') class TestDataDumps(ModuleStoreTestCase): """ Test data dumps for reporting. diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index 7d01588ebe..e998f5576d 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -95,22 +95,25 @@ END exit $EXIT ;; - "unit") + "lms-unit") case "$SHARD" in - "lms") - SHARD=1 paver test_system -s lms --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; } + "1") + paver test_system -s lms --extra_args="--attr='shard_1' --with-flaky" --cov_args="-p" || { EXIT=1; } ;; - "cms-js-commonlib") - SHARD=1 paver test_system -s cms --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; } - SHARD=1 paver test_js --coverage --skip_clean || { EXIT=1; } - SHARD=1 paver test_lib --skip_clean --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; } + "2") + paver test_system -s lms --extra_args="--attr='shard_1=False' --with-flaky" --cov_args="-p" || { EXIT=1; } ;; *) - paver test --extra_args="--with-flaky" - paver coverage + paver test_system -s lms --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; } ;; esac + exit $EXIT + ;; + "other-unit") + paver test_system -s cms --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; } + paver test_js --coverage --skip_clean || { EXIT=1; } + paver test_lib --skip_clean --extra_args="--with-flaky" --cov_args="-p" || { EXIT=1; } exit $EXIT ;; diff --git a/scripts/jenkins-report.sh b/scripts/jenkins-report.sh index 0a012f0b88..fde207d7ab 100755 --- a/scripts/jenkins-report.sh +++ b/scripts/jenkins-report.sh @@ -7,6 +7,9 @@ paver combine_jenkins_coverage # Get the diff coverage and html reports for unit tests paver coverage +# Get coverage reports for bok choy +# paver bokchoy_coverage + # JUnit test reporter will fail the build # if it thinks test results are old touch `find . -name *.xml` || true