diff --git a/lms/djangoapps/discussion_api/tests/test_api.py b/lms/djangoapps/discussion_api/tests/test_api.py index 5decbe898ee2477a8501c8a2ea6f02711cc66d05..6bdcf514ab7f404710fb579992be8c6797a66dba 100644 --- a/lms/djangoapps/discussion_api/tests/test_api.py +++ b/lms/djangoapps/discussion_api/tests/test_api.py @@ -9,6 +9,7 @@ from urllib import urlencode import ddt import httpretty import mock +from nose.plugins.attrib import attr from pytz import UTC from django.core.exceptions import ValidationError @@ -82,6 +83,7 @@ def _discussion_disabled_course_for(user): return course_with_disabled_forums +@attr('shard_2') @ddt.ddt @mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) class GetCourseTest(UrlResetMixin, SharedModuleStoreTestCase): @@ -155,6 +157,7 @@ class GetCourseTest(UrlResetMixin, SharedModuleStoreTestCase): self.assertEqual(result["blackouts"], []) +@attr('shard_2') @mock.patch.dict("django.conf.settings.FEATURES", {"DISABLE_START_DATES": False}) @mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) class GetCourseTopicsTest(UrlResetMixin, ModuleStoreTestCase): @@ -481,6 +484,7 @@ class GetCourseTopicsTest(UrlResetMixin, ModuleStoreTestCase): self.assertEqual(staff_actual, staff_expected) +@attr('shard_2') @ddt.ddt @mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) class GetThreadListTest(CommentsServiceMockMixin, UrlResetMixin, SharedModuleStoreTestCase): @@ -930,6 +934,7 @@ class GetThreadListTest(CommentsServiceMockMixin, UrlResetMixin, SharedModuleSto }) +@attr('shard_2') @ddt.ddt @mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) class GetCommentListTest(CommentsServiceMockMixin, SharedModuleStoreTestCase): @@ -1353,6 +1358,7 @@ class GetCommentListTest(CommentsServiceMockMixin, SharedModuleStoreTestCase): self.get_comment_list(thread, endorsed=True, page=2, page_size=10) +@attr('shard_2') @ddt.ddt @disable_signal(api, 'thread_created') @disable_signal(api, 'thread_voted') @@ -1604,6 +1610,7 @@ class CreateThreadTest( create_thread(self.request, data) +@attr('shard_2') @ddt.ddt @disable_signal(api, 'comment_created') @disable_signal(api, 'comment_voted') @@ -1870,6 +1877,7 @@ class CreateCommentTest( create_comment(self.request, data) +@attr('shard_2') @ddt.ddt @disable_signal(api, 'thread_edited') @disable_signal(api, 'thread_voted') @@ -2278,6 +2286,7 @@ class UpdateThreadTest( ) +@attr('shard_2') @ddt.ddt @disable_signal(api, 'comment_edited') @disable_signal(api, 'comment_voted') @@ -2681,6 +2690,7 @@ class UpdateCommentTest( ) +@attr('shard_2') @ddt.ddt @disable_signal(api, 'thread_deleted') @mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) @@ -2820,6 +2830,7 @@ class DeleteThreadTest( self.assertTrue(expected_error) +@attr('shard_2') @ddt.ddt @disable_signal(api, 'comment_deleted') @mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) @@ -2978,6 +2989,7 @@ class DeleteCommentTest( self.assertTrue(expected_error) +@attr('shard_2') @ddt.ddt @mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) class RetrieveThreadTest( diff --git a/lms/djangoapps/django_comment_client/base/tests.py b/lms/djangoapps/django_comment_client/base/tests.py index abda87d29cddb4ea1d1c7247079b5599828685ad..1df1b28ffb08c3053ff86bb3f8b908e3ec4c4f3b 100644 --- a/lms/djangoapps/django_comment_client/base/tests.py +++ b/lms/djangoapps/django_comment_client/base/tests.py @@ -13,6 +13,7 @@ from django.core.urlresolvers import reverse from request_cache.middleware import RequestCache from mock import patch, ANY, Mock from nose.tools import assert_true, assert_equal +from nose.plugins.attrib import attr from opaque_keys.edx.keys import CourseKey from lms.lib.comment_client import Thread @@ -48,6 +49,7 @@ class MockRequestSetupMixin(object): mock_request.return_value = self._create_response_mock(data) +@attr('shard_2') @patch('lms.lib.comment_client.utils.requests.request', autospec=True) class CreateThreadGroupIdTestCase( MockRequestSetupMixin, @@ -83,6 +85,7 @@ class CreateThreadGroupIdTestCase( self._assert_json_response_contains_group_info(response) +@attr('shard_2') @patch('lms.lib.comment_client.utils.requests.request', autospec=True) @disable_signal(views, 'thread_edited') @disable_signal(views, 'thread_voted') @@ -340,6 +343,7 @@ class ViewsTestCaseMixin(object): self.assertEqual(data['commentable_id'], 'some_topic') +@attr('shard_2') @ddt.ddt @patch('lms.lib.comment_client.utils.requests.request', autospec=True) @disable_signal(views, 'thread_created') @@ -389,6 +393,7 @@ class ViewsQueryCountTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSet self.update_thread_helper(mock_request) +@attr('shard_2') @ddt.ddt @patch('lms.lib.comment_client.utils.requests.request', autospec=True) class ViewsTestCase( @@ -1016,6 +1021,7 @@ class ViewsTestCase( self.assertEqual(response.status_code, 200) +@attr('shard_2') @patch("lms.lib.comment_client.utils.requests.request", autospec=True) @disable_signal(views, 'comment_endorsed') class ViewPermissionsTestCase(UrlResetMixin, SharedModuleStoreTestCase, MockRequestSetupMixin): @@ -1125,6 +1131,7 @@ class ViewPermissionsTestCase(UrlResetMixin, SharedModuleStoreTestCase, MockRequ self.assertEqual(response.status_code, 200) +@attr('shard_2') class CreateThreadUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): @classmethod @@ -1160,6 +1167,7 @@ class CreateThreadUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, M self.assertEqual(mock_request.call_args[1]["data"]["title"], text) +@attr('shard_2') @disable_signal(views, 'thread_edited') class UpdateThreadUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): @@ -1197,6 +1205,7 @@ class UpdateThreadUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, M self.assertEqual(mock_request.call_args[1]["data"]["commentable_id"], "test_commentable") +@attr('shard_2') @disable_signal(views, 'comment_created') class CreateCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): @@ -1239,6 +1248,7 @@ class CreateCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, del Thread.commentable_id +@attr('shard_2') @disable_signal(views, 'comment_edited') class UpdateCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): @@ -1272,6 +1282,7 @@ class UpdateCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, self.assertEqual(mock_request.call_args[1]["data"]["body"], text) +@attr('shard_2') @disable_signal(views, 'comment_created') class CreateSubCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin): """ @@ -1318,6 +1329,7 @@ class CreateSubCommentUnicodeTestCase(SharedModuleStoreTestCase, UnicodeTestMixi del Thread.commentable_id +@attr('shard_2') @ddt.ddt @patch("lms.lib.comment_client.utils.requests.request", autospec=True) @disable_signal(views, 'thread_voted') @@ -1589,6 +1601,7 @@ class TeamsPermissionsTestCase(UrlResetMixin, SharedModuleStoreTestCase, MockReq TEAM_COMMENTABLE_ID = 'test-team-discussion' +@attr('shard_2') @disable_signal(views, 'comment_created') @ddt.ddt class ForumEventTestCase(SharedModuleStoreTestCase, MockRequestSetupMixin): @@ -1774,6 +1787,7 @@ class ForumEventTestCase(SharedModuleStoreTestCase, MockRequestSetupMixin): self.assertEqual(event['vote_value'], 'up') +@attr('shard_2') class UsersEndpointTestCase(SharedModuleStoreTestCase, MockRequestSetupMixin): @classmethod diff --git a/lms/djangoapps/mobile_api/users/tests.py b/lms/djangoapps/mobile_api/users/tests.py index 270587e8b76a6ee6f61ab24b4b49fffba6daad68..671872b7ca90c88b9edf58621e8f106cfb72ec0f 100644 --- a/lms/djangoapps/mobile_api/users/tests.py +++ b/lms/djangoapps/mobile_api/users/tests.py @@ -5,6 +5,7 @@ Tests for users API import datetime import ddt from mock import patch +from nose.plugins.attrib import attr import pytz from django.conf import settings @@ -34,6 +35,7 @@ from ..testutils import MobileAPITestCase, MobileAuthTestMixin, MobileAuthUserTe from .serializers import CourseEnrollmentSerializer +@attr('shard_2') class TestUserDetailApi(MobileAPITestCase, MobileAuthUserTestMixin): """ Tests for /api/mobile/v0.5/users/<user_name>... @@ -48,6 +50,7 @@ class TestUserDetailApi(MobileAPITestCase, MobileAuthUserTestMixin): self.assertEqual(response.data['email'], self.user.email) +@attr('shard_2') class TestUserInfoApi(MobileAPITestCase, MobileAuthTestMixin): """ Tests for /api/mobile/v0.5/my_user_info @@ -63,6 +66,7 @@ class TestUserInfoApi(MobileAPITestCase, MobileAuthTestMixin): self.assertTrue(self.username in response['location']) +@attr('shard_2') @ddt.ddt class TestUserEnrollmentApi(UrlResetMixin, MobileAPITestCase, MobileAuthUserTestMixin, MobileCourseAccessTestMixin, MilestonesTestCaseMixin): @@ -262,6 +266,7 @@ class TestUserEnrollmentApi(UrlResetMixin, MobileAPITestCase, MobileAuthUserTest self.assertIn('/api/discussion/v1/courses/{}'.format(self.course.id), response_discussion_url) +@attr('shard_2') class CourseStatusAPITestCase(MobileAPITestCase): """ Base test class for /api/mobile/v0.5/users/<user_name>/course_status_info/{course_id} @@ -296,6 +301,7 @@ class CourseStatusAPITestCase(MobileAPITestCase): ) +@attr('shard_2') class TestCourseStatusGET(CourseStatusAPITestCase, MobileAuthUserTestMixin, MobileCourseAccessTestMixin, MilestonesTestCaseMixin): """ @@ -315,6 +321,7 @@ class TestCourseStatusGET(CourseStatusAPITestCase, MobileAuthUserTestMixin, ) +@attr('shard_2') class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, MobileCourseAccessTestMixin, MilestonesTestCaseMixin): """ @@ -418,6 +425,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, ) +@attr('shard_2') class TestCourseEnrollmentSerializer(MobileAPITestCase): """ Test the course enrollment serializer diff --git a/lms/djangoapps/mobile_api/video_outlines/tests.py b/lms/djangoapps/mobile_api/video_outlines/tests.py index 48b61b7adcb191e7ff535a11372a2b3cddbd148c..9a0217d5d34ff62ac257d41d5c7869579277aadf 100644 --- a/lms/djangoapps/mobile_api/video_outlines/tests.py +++ b/lms/djangoapps/mobile_api/video_outlines/tests.py @@ -5,6 +5,7 @@ Tests for video outline API import ddt import itertools +from nose.plugins.attrib import attr from uuid import uuid4 from collections import namedtuple @@ -199,6 +200,7 @@ class TestVideoAPIMixin(object): return sub_block_a, sub_block_b +@attr('shard_2') class TestNonStandardCourseStructure(MobileAPITestCase, TestVideoAPIMixin): """ Tests /api/mobile/v0.5/video_outlines/courses/{course_id} with no course set @@ -408,6 +410,7 @@ class TestNonStandardCourseStructure(MobileAPITestCase, TestVideoAPIMixin): ) +@attr('shard_2') @ddt.ddt class TestVideoSummaryList(TestVideoAPITestCase, MobileAuthTestMixin, MobileCourseAccessTestMixin, TestVideoAPIMixin, MilestonesTestCaseMixin): @@ -864,6 +867,7 @@ class TestVideoSummaryList(TestVideoAPITestCase, MobileAuthTestMixin, MobileCour ) +@attr('shard_2') class TestTranscriptsDetail(TestVideoAPITestCase, MobileAuthTestMixin, MobileCourseAccessTestMixin, TestVideoAPIMixin, MilestonesTestCaseMixin): """ diff --git a/lms/djangoapps/verify_student/tests/test_views.py b/lms/djangoapps/verify_student/tests/test_views.py index 2a876035ed4eddd51ae9c76ccd46786ccbc114e7..7acc7194c51257c4f67a37837e7d2d3eb057ea93 100644 --- a/lms/djangoapps/verify_student/tests/test_views.py +++ b/lms/djangoapps/verify_student/tests/test_views.py @@ -11,6 +11,7 @@ from uuid import uuid4 import ddt import httpretty import mock +from nose.plugins.attrib import attr import boto import moto import pytz @@ -67,7 +68,12 @@ render_mock = Mock(side_effect=mock_render_to_response) PAYMENT_DATA_KEYS = {'payment_processor_name', 'payment_page_url', 'payment_form_data'} +@attr('shard_2') class StartView(TestCase): + """ + This view is for the first time student is + attempting a Photo Verification. + """ def start_url(self, course_id=""): return "/verify_student/{0}".format(urllib.quote(course_id)) @@ -83,6 +89,7 @@ class StartView(TestCase): self.assertHttpForbidden(self.client.get(self.start_url())) +@attr('shard_2') @ddt.ddt class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase, XssTestMixin): """ @@ -1173,6 +1180,7 @@ class CheckoutTestMixin(object): self.assertEqual(data, {'foo': 'bar'}) +@attr('shard_2') @patch('lms.djangoapps.verify_student.views.checkout_with_shoppingcart', return_value=TEST_PAYMENT_DATA, autospec=True) class TestCreateOrderShoppingCart(CheckoutTestMixin, ModuleStoreTestCase): """ Test view behavior when the shoppingcart is used. """ @@ -1186,6 +1194,7 @@ class TestCreateOrderShoppingCart(CheckoutTestMixin, ModuleStoreTestCase): return dict(zip(('request', 'user', 'course_key', 'course_mode', 'amount'), patched_create_order.call_args[0])) +@attr('shard_2') @override_settings(ECOMMERCE_API_URL=TEST_API_URL, ECOMMERCE_API_SIGNING_KEY=TEST_API_SIGNING_KEY) @patch( 'lms.djangoapps.verify_student.views.checkout_with_ecommerce_service', @@ -1204,6 +1213,7 @@ class TestCreateOrderEcommerceService(CheckoutTestMixin, ModuleStoreTestCase): return dict(zip(('user', 'course_key', 'course_mode', 'processor'), patched_create_order.call_args[0])) +@attr('shard_2') class TestCheckoutWithEcommerceService(ModuleStoreTestCase): """ Ensures correct behavior in the function `checkout_with_ecommerce_service`. @@ -1249,6 +1259,7 @@ class TestCheckoutWithEcommerceService(ModuleStoreTestCase): self.assertEqual(actual_payment_data, expected_payment_data) +@attr('shard_2') class TestCreateOrderView(ModuleStoreTestCase): """ Tests for the create_order view of verified course enrollment process. @@ -1352,6 +1363,7 @@ class TestCreateOrderView(ModuleStoreTestCase): return response +@attr('shard_2') @ddt.ddt @patch.dict(settings.FEATURES, {'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': True}) class TestSubmitPhotosForVerification(TestCase): @@ -1593,6 +1605,7 @@ class TestSubmitPhotosForVerification(TestCase): return json.loads(last_request.body) +@attr('shard_2') class TestPhotoVerificationResultsCallback(ModuleStoreTestCase): """ Tests for the results_callback view. @@ -1954,6 +1967,7 @@ class TestPhotoVerificationResultsCallback(ModuleStoreTestCase): VerificationStatus.add_verification_status(checkpoint, self.user, "submitted") +@attr('shard_2') class TestReverifyView(TestCase): """ Tests for the reverification view. @@ -2048,6 +2062,7 @@ class TestReverifyView(TestCase): self.assertContains(response, "reverify-blocked") +@attr('shard_2') class TestInCourseReverifyView(ModuleStoreTestCase): """ Tests for the incourse reverification views. @@ -2247,6 +2262,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase): return self.client.post(url, data) +@attr('shard_2') class TestEmailMessageWithCustomICRVBlock(ModuleStoreTestCase): """ Test email sending on re-verification @@ -2451,6 +2467,7 @@ class TestEmailMessageWithCustomICRVBlock(ModuleStoreTestCase): ) +@attr('shard_2') class TestEmailMessageWithDefaultICRVBlock(ModuleStoreTestCase): """ Test for In-course Re-verification diff --git a/openedx/core/djangoapps/bookmarks/tests/test_api.py b/openedx/core/djangoapps/bookmarks/tests/test_api.py index f9e6f36dfe5c7d0f4e463a378f08d775291b00e7..6484047eba507150659b846ec1b4e8bb5949eee7 100644 --- a/openedx/core/djangoapps/bookmarks/tests/test_api.py +++ b/openedx/core/djangoapps/bookmarks/tests/test_api.py @@ -3,6 +3,7 @@ Tests for bookmarks api. """ import ddt from mock import patch +from nose.plugins.attrib import attr from unittest import skipUnless from django.conf import settings @@ -35,6 +36,7 @@ class BookmarkApiEventTestMixin(object): self.assertFalse(mock_tracker.called) # pylint: disable=maybe-no-member +@attr('shard_2') @ddt.ddt @skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Tests only valid in LMS') class BookmarksAPITests(BookmarkApiEventTestMixin, BookmarksTestsBase): diff --git a/openedx/core/djangoapps/bookmarks/tests/test_models.py b/openedx/core/djangoapps/bookmarks/tests/test_models.py index 8166c75d64906990217ba9faff9860e9c79e8afb..a2b762a2bb4f8305b9a8b194ada32734748f38ee 100644 --- a/openedx/core/djangoapps/bookmarks/tests/test_models.py +++ b/openedx/core/djangoapps/bookmarks/tests/test_models.py @@ -6,6 +6,7 @@ import datetime import ddt from freezegun import freeze_time import mock +from nose.plugins.attrib import attr import pytz from unittest import skipUnless @@ -223,6 +224,7 @@ class BookmarksTestsBase(ModuleStoreTestCase): self.assertEqual(bookmark_data['path'], bookmark.path) +@attr('shard_2') @ddt.ddt @skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Tests only valid in LMS') class BookmarkModelTests(BookmarksTestsBase): @@ -407,6 +409,7 @@ class BookmarkModelTests(BookmarksTestsBase): self.assertEqual(bookmark.path, []) +@attr('shard_2') @ddt.ddt class XBlockCacheModelTest(ModuleStoreTestCase): """ diff --git a/openedx/core/djangoapps/bookmarks/tests/test_services.py b/openedx/core/djangoapps/bookmarks/tests/test_services.py index d55ab4d37b871cb4f23e0908ac89712d537798d8..4be7d32207c4060c777e9a04bb205c2395f8db4b 100644 --- a/openedx/core/djangoapps/bookmarks/tests/test_services.py +++ b/openedx/core/djangoapps/bookmarks/tests/test_services.py @@ -1,6 +1,7 @@ """ Tests for bookmark services. """ +from nose.plugins.attrib import attr from unittest import skipUnless from django.conf import settings @@ -11,6 +12,7 @@ from ..services import BookmarksService from .test_models import BookmarksTestsBase +@attr('shard_2') @skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Tests only valid in LMS') class BookmarksServiceTests(BookmarksTestsBase): """ diff --git a/openedx/core/djangoapps/bookmarks/tests/test_tasks.py b/openedx/core/djangoapps/bookmarks/tests/test_tasks.py index 8aefa79201d6601bcd20b9d796c394a2af63af37..c8a789d74a740ea1b3dcf9d90f0ce1a0b9cb3791 100644 --- a/openedx/core/djangoapps/bookmarks/tests/test_tasks.py +++ b/openedx/core/djangoapps/bookmarks/tests/test_tasks.py @@ -2,6 +2,7 @@ Tests for tasks. """ import ddt +from nose.plugins.attrib import attr from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.factories import check_mongo_calls, ItemFactory @@ -11,6 +12,7 @@ from ..tasks import _calculate_course_xblocks_data, _update_xblocks_cache from .test_models import BookmarksTestsBase +@attr('shard_2') @ddt.ddt class XBlockCacheTaskTests(BookmarksTestsBase): """ diff --git a/openedx/core/djangoapps/bookmarks/tests/test_views.py b/openedx/core/djangoapps/bookmarks/tests/test_views.py index 3583cac128260c7cd234e6c51df0002dda6772bb..2b63b1fb7fa468e238284cba5743316b1c5b7118 100644 --- a/openedx/core/djangoapps/bookmarks/tests/test_views.py +++ b/openedx/core/djangoapps/bookmarks/tests/test_views.py @@ -4,6 +4,7 @@ Tests for bookmark views. import ddt import json +from nose.plugins.attrib import attr from unittest import skipUnless import urllib @@ -63,6 +64,7 @@ class BookmarksViewsTestsBase(BookmarksTestsBase, BookmarkApiEventTestMixin): return response +@attr('shard_2') @ddt.ddt @skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Tests only valid in LMS') class BookmarksListViewTests(BookmarksViewsTestsBase): @@ -367,6 +369,7 @@ class BookmarksListViewTests(BookmarksViewsTestsBase): ) +@attr('shard_2') @ddt.ddt @skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Tests only valid in LMS') class BookmarksDetailViewTests(BookmarksViewsTestsBase): diff --git a/openedx/core/djangoapps/ccxcon/tests/test_signals.py b/openedx/core/djangoapps/ccxcon/tests/test_signals.py index 559a28e307b0310dd90ecd623c5ad82a9e033681..5de4c74d68ed16fa05529c679437c5d8a47504e0 100644 --- a/openedx/core/djangoapps/ccxcon/tests/test_signals.py +++ b/openedx/core/djangoapps/ccxcon/tests/test_signals.py @@ -3,12 +3,14 @@ Test for contentstore signals receiver """ import mock +from nose.plugins.attrib import attr from django.test import TestCase from opaque_keys.edx.keys import CourseKey from xmodule.modulestore.django import modulestore, SignalHandler +@attr('shard_2') class CCXConSignalTestCase(TestCase): """ The only tests currently implemented are for verifying that diff --git a/openedx/core/djangoapps/ccxcon/tests/test_tasks.py b/openedx/core/djangoapps/ccxcon/tests/test_tasks.py index 68d54c3c620f656c7da754bfd041d01a27c98473..de42bf20795dbf144938f221f1999499af90cdcd 100644 --- a/openedx/core/djangoapps/ccxcon/tests/test_tasks.py +++ b/openedx/core/djangoapps/ccxcon/tests/test_tasks.py @@ -3,6 +3,7 @@ Tests for the CCXCon celery tasks """ import mock +from nose.plugins.attrib import attr from django.test import TestCase @@ -10,6 +11,7 @@ from opaque_keys.edx.keys import CourseKey from openedx.core.djangoapps.ccxcon import api, tasks +@attr('shard_2') class CCXConTaskTestCase(TestCase): """ Tests for CCXCon tasks. diff --git a/openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_generate_course_overview.py b/openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_generate_course_overview.py index 025617e1ea05bc1c7abd5b02d3e7890c7394576a..248c034816ecdf3dd86a4e475338983df10c55ef 100644 --- a/openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_generate_course_overview.py +++ b/openedx/core/djangoapps/content/course_overviews/management/commands/tests/test_generate_course_overview.py @@ -1,12 +1,14 @@ # pylint: disable=missing-docstring from django.core.management.base import CommandError from mock import patch +from nose.plugins.attrib import attr from openedx.core.djangoapps.content.course_overviews.management.commands import generate_course_overview from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory +@attr('shard_2') class TestGenerateCourseOverview(ModuleStoreTestCase): """ Tests course overview management command. diff --git a/openedx/core/djangoapps/content/course_structures/tests.py b/openedx/core/djangoapps/content/course_structures/tests.py index 8db13b51050c6c79c96554f15c10bb68126c83de..b87385a9df3529b4c32b117b4e1272b845c8d6e2 100644 --- a/openedx/core/djangoapps/content/course_structures/tests.py +++ b/openedx/core/djangoapps/content/course_structures/tests.py @@ -2,6 +2,7 @@ Course Structure Content sub-application test cases """ import json +from nose.plugins.attrib import attr from xmodule_django.models import UsageKey from xmodule.modulestore.django import SignalHandler @@ -22,6 +23,7 @@ class SignalDisconnectTestMixin(object): SignalHandler.course_published.disconnect(listen_for_course_publish) +@attr('shard_2') class CourseStructureTaskTests(ModuleStoreTestCase): """ Test cases covering Course Structure task-related workflows diff --git a/openedx/core/djangoapps/course_groups/management/commands/tests/test_post_cohort_membership_fix.py b/openedx/core/djangoapps/course_groups/management/commands/tests/test_post_cohort_membership_fix.py index 893d0e777c4bcf10b902c4c57c99ff5b05bc95e6..bd6ca8efbc3f2aadb3df46f7a79f573295746f13 100644 --- a/openedx/core/djangoapps/course_groups/management/commands/tests/test_post_cohort_membership_fix.py +++ b/openedx/core/djangoapps/course_groups/management/commands/tests/test_post_cohort_membership_fix.py @@ -3,6 +3,7 @@ Test for the post-migration fix commands that are included with this djangoapp """ from django.core.management import call_command from django.test.client import RequestFactory +from nose.plugins.attrib import attr from openedx.core.djangoapps.course_groups.views import cohort_handler from openedx.core.djangoapps.course_groups.cohorts import get_cohort_by_name @@ -13,6 +14,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory +@attr('shard_2') class TestPostMigrationFix(ModuleStoreTestCase): """ Base class for testing post-migration fix commands diff --git a/openedx/core/djangoapps/course_groups/tests/test_cohorts.py b/openedx/core/djangoapps/course_groups/tests/test_cohorts.py index 1782a9c62f1b1f36ecdfe81ad258e9f35065ce92..1a0986df9c515edb5ac98e06b754972bca6d3701 100644 --- a/openedx/core/djangoapps/course_groups/tests/test_cohorts.py +++ b/openedx/core/djangoapps/course_groups/tests/test_cohorts.py @@ -4,6 +4,7 @@ Tests for cohorts # pylint: disable=no-member import ddt from mock import call, patch +from nose.plugins.attrib import attr import before_after from django.contrib.auth.models import User @@ -25,6 +26,7 @@ from ..tests.helpers import ( ) +@attr('shard_2') @patch("openedx.core.djangoapps.course_groups.cohorts.tracker", autospec=True) class TestCohortSignals(TestCase): """ @@ -130,6 +132,7 @@ class TestCohortSignals(TestCase): self.assertFalse(mock_tracker.emit.called) +@attr('shard_2') @ddt.ddt class TestCohorts(ModuleStoreTestCase): """ @@ -723,6 +726,7 @@ class TestCohorts(ModuleStoreTestCase): ) +@attr('shard_2') @ddt.ddt class TestCohortsAndPartitionGroups(ModuleStoreTestCase): """ diff --git a/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py b/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py index 9bcdf18baca8d8182c70f448a6f34c82d72ad03a..df76894633d73aa68bd161735b385e2723c830ef 100644 --- a/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py +++ b/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py @@ -7,6 +7,7 @@ import json from django.conf import settings import django.test from mock import patch +from nose.plugins.attrib import attr from unittest import skipUnless from courseware.masquerade import handle_ajax, setup_masquerade @@ -25,6 +26,7 @@ from ..cohorts import add_user_to_cohort, remove_user_from_cohort, get_course_co from .helpers import CohortFactory, config_course_cohorts +@attr('shard_2') class TestCohortPartitionScheme(ModuleStoreTestCase): """ Test the logic for linking a user to a partition group based on their cohort. @@ -258,6 +260,7 @@ class TestCohortPartitionScheme(ModuleStoreTestCase): self.assertRegexpMatches(mock_log.warn.call_args[0][0], 'partition mismatch') +@attr('shard_2') class TestExtension(django.test.TestCase): """ Ensure that the scheme extension is correctly plugged in (via entry point @@ -270,6 +273,7 @@ class TestExtension(django.test.TestCase): UserPartition.get_scheme('other') +@attr('shard_2') class TestGetCohortedUserPartition(ModuleStoreTestCase): """ Test that `get_cohorted_user_partition` returns the first user_partition with scheme `CohortPartitionScheme`. @@ -327,6 +331,7 @@ class TestGetCohortedUserPartition(ModuleStoreTestCase): self.assertIsNone(get_cohorted_user_partition(self.course)) +@attr('shard_2') class TestMasqueradedGroup(StaffMasqueradeTestCase): """ Check for staff being able to masquerade as belonging to a group. diff --git a/openedx/core/djangoapps/course_groups/tests/test_views.py b/openedx/core/djangoapps/course_groups/tests/test_views.py index 92b307575fb5ec7b8896388afb87d8662fe2b1e9..227cb23f35df25cbe03338f729e5c67eb3026884 100644 --- a/openedx/core/djangoapps/course_groups/tests/test_views.py +++ b/openedx/core/djangoapps/course_groups/tests/test_views.py @@ -7,6 +7,7 @@ import json from collections import namedtuple from datetime import datetime +from nose.plugins.attrib import attr from unittest import skipUnless from django.conf import settings @@ -35,6 +36,7 @@ from .helpers import ( ) +@attr('shard_2') class CohortViewsTestCase(ModuleStoreTestCase): """ Base class which sets up a course and staff/non-staff users. @@ -174,6 +176,7 @@ class CohortViewsTestCase(ModuleStoreTestCase): return json.loads(response.content) +@attr('shard_2') class CourseCohortSettingsHandlerTestCase(CohortViewsTestCase): """ Tests the `course_cohort_settings_handler` view. @@ -323,6 +326,7 @@ class CourseCohortSettingsHandlerTestCase(CohortViewsTestCase): ) +@attr('shard_2') class CohortHandlerTestCase(CohortViewsTestCase): """ Tests the `cohort_handler` view. @@ -675,6 +679,7 @@ class CohortHandlerTestCase(CohortViewsTestCase): ) +@attr('shard_2') class UsersInCohortTestCase(CohortViewsTestCase): """ Tests the `users_in_cohort` view. @@ -807,6 +812,7 @@ class UsersInCohortTestCase(CohortViewsTestCase): self.request_users_in_cohort(cohort, self.course, -1, should_return_bad_request=True) +@attr('shard_2') class AddUsersToCohortTestCase(CohortViewsTestCase): """ Tests the `add_users_to_cohort` view. @@ -1105,6 +1111,7 @@ class AddUsersToCohortTestCase(CohortViewsTestCase): ) +@attr('shard_2') class RemoveUserFromCohortTestCase(CohortViewsTestCase): """ Tests the `remove_user_from_cohort` view. @@ -1198,6 +1205,7 @@ class RemoveUserFromCohortTestCase(CohortViewsTestCase): self.verify_removed_user_from_cohort(user.username, response_dict, cohort) +@attr('shard_2') @skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Tests only valid in LMS') class CourseCohortDiscussionTopicsTestCase(CohortViewsTestCase): """ diff --git a/openedx/core/djangoapps/credentials/tests/test_models.py b/openedx/core/djangoapps/credentials/tests/test_models.py index d1556c43f53eb4544c007cfe93a1d4608d6d5713..697482200a1f8fcfc435e0b3fe12aac5e8567edc 100644 --- a/openedx/core/djangoapps/credentials/tests/test_models.py +++ b/openedx/core/djangoapps/credentials/tests/test_models.py @@ -4,11 +4,12 @@ import unittest from django.conf import settings from django.test import TestCase - +from nose.plugins.attrib import attr from openedx.core.djangoapps.credentials.tests.mixins import CredentialsApiConfigMixin @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') +@attr('shard_2') class TestCredentialsApiConfig(CredentialsApiConfigMixin, TestCase): """Tests covering the CredentialsApiConfig model.""" def test_url_construction(self): diff --git a/openedx/core/djangoapps/credentials/tests/test_utils.py b/openedx/core/djangoapps/credentials/tests/test_utils.py index e3116b8989fb867fbd74888049443f7f31e69fb1..171d59d80536f5b61e8ea472a0f87f36fa35bbad 100644 --- a/openedx/core/djangoapps/credentials/tests/test_utils.py +++ b/openedx/core/djangoapps/credentials/tests/test_utils.py @@ -4,6 +4,7 @@ import unittest from django.conf import settings from django.core.cache import cache from django.test import TestCase +from nose.plugins.attrib import attr import httpretty from oauth2_provider.tests.factories import ClientFactory from provider.constants import CONFIDENTIAL @@ -19,6 +20,7 @@ from student.tests.factories import UserFactory @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') +@attr('shard_2') class TestCredentialsRetrieval(ProgramsApiConfigMixin, CredentialsApiConfigMixin, CredentialsDataMixin, ProgramsDataMixin, TestCase): """ Tests covering the retrieval of user credentials from the Credentials diff --git a/openedx/core/djangoapps/credit/tests/test_api.py b/openedx/core/djangoapps/credit/tests/test_api.py index 987a78f8fe1741fef76999acd6ad6d3fbc59ec33..d58d151d5c527815229f07d4d46911188b7cd21d 100644 --- a/openedx/core/djangoapps/credit/tests/test_api.py +++ b/openedx/core/djangoapps/credit/tests/test_api.py @@ -9,6 +9,7 @@ from django.conf import settings from django.core import mail from django.test.utils import override_settings from django.db import connection, transaction +from nose.plugins.attrib import attr from opaque_keys.edx.keys import CourseKey import pytz from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -86,6 +87,7 @@ class CreditApiTestBase(ModuleStoreTestCase): return credit_course +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in LMS') @ddt.ddt class CreditRequirementApiTests(CreditApiTestBase): @@ -550,6 +552,7 @@ class CreditRequirementApiTests(CreditApiTestBase): self.assertEqual(req_status[0]["status"], None) +@attr('shard_2') @ddt.ddt class CreditProviderIntegrationApiTests(CreditApiTestBase): """ diff --git a/openedx/core/djangoapps/credit/tests/test_models.py b/openedx/core/djangoapps/credit/tests/test_models.py index 733876f198f3cee79784bfaa171c2a7d99eadeae..f731915b84f44b49d4b5fc0d19be656267bd77f3 100644 --- a/openedx/core/djangoapps/credit/tests/test_models.py +++ b/openedx/core/djangoapps/credit/tests/test_models.py @@ -5,11 +5,13 @@ Tests for credit course models. import ddt from django.test import TestCase +from nose.plugins.attrib import attr from opaque_keys.edx.keys import CourseKey from openedx.core.djangoapps.credit.models import CreditCourse, CreditRequirement +@attr('shard_2') @ddt.ddt class CreditEligibilityModelTests(TestCase): """ diff --git a/openedx/core/djangoapps/credit/tests/test_partition.py b/openedx/core/djangoapps/credit/tests/test_partition.py index f6d74f51b047a2c382bc66421016c7633e7f152a..96fe676ac1c04c9c9ffe66dc563749d3edb3587a 100644 --- a/openedx/core/djangoapps/credit/tests/test_partition.py +++ b/openedx/core/djangoapps/credit/tests/test_partition.py @@ -4,6 +4,7 @@ Tests for In-Course Reverification Access Control Partition scheme """ import ddt +from nose.plugins.attrib import attr import unittest from django.conf import settings @@ -21,6 +22,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory +@attr('shard_2') @ddt.ddt @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class ReverificationPartitionTest(ModuleStoreTestCase): diff --git a/openedx/core/djangoapps/credit/tests/test_serializers.py b/openedx/core/djangoapps/credit/tests/test_serializers.py index 9526627ac2fab90c1119b1d116a2584d950bc847..06aed06717365c7f455d6d82fe476523e14144fc 100644 --- a/openedx/core/djangoapps/credit/tests/test_serializers.py +++ b/openedx/core/djangoapps/credit/tests/test_serializers.py @@ -5,11 +5,13 @@ from __future__ import unicode_literals from django.test import TestCase +from nose.plugins.attrib import attr from openedx.core.djangoapps.credit import serializers from openedx.core.djangoapps.credit.tests.factories import CreditProviderFactory, CreditEligibilityFactory from student.tests.factories import UserFactory +@attr('shard_2') class CreditProviderSerializerTests(TestCase): """ CreditProviderSerializer tests. """ @@ -30,6 +32,7 @@ class CreditProviderSerializerTests(TestCase): self.assertDictEqual(serializer.data, expected) +@attr('shard_2') class CreditEligibilitySerializerTests(TestCase): """ CreditEligibilitySerializer tests. """ diff --git a/openedx/core/djangoapps/credit/tests/test_services.py b/openedx/core/djangoapps/credit/tests/test_services.py index 8a6fe0746daa90c7a0dd4168405c41e2f73be33f..aeaf047c679e7805a6265c136190373116987394 100644 --- a/openedx/core/djangoapps/credit/tests/test_services.py +++ b/openedx/core/djangoapps/credit/tests/test_services.py @@ -2,6 +2,8 @@ Tests for the Credit xBlock service """ +from nose.plugins.attrib import attr + from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory @@ -12,6 +14,7 @@ from openedx.core.djangoapps.credit.api.eligibility import set_credit_requiremen from student.models import CourseEnrollment, UserProfile +@attr('shard_2') class CreditServiceTests(ModuleStoreTestCase): """ Tests for the Credit xBlock service diff --git a/openedx/core/djangoapps/credit/tests/test_signals.py b/openedx/core/djangoapps/credit/tests/test_signals.py index f6013f6e25aca6d6f70ffe644c089d0884599876..f2480e9d5b5522ced0b954f46c127272a6850310 100644 --- a/openedx/core/djangoapps/credit/tests/test_signals.py +++ b/openedx/core/djangoapps/credit/tests/test_signals.py @@ -5,6 +5,7 @@ Tests for minimum grade requirement status import pytz import ddt from datetime import timedelta, datetime +from nose.plugins.attrib import attr from django.conf import settings from django.test.client import RequestFactory @@ -21,6 +22,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory +@attr('shard_2') @skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in LMS') @ddt.ddt class TestMinGradedRequirementStatus(ModuleStoreTestCase): diff --git a/openedx/core/djangoapps/credit/tests/test_signature.py b/openedx/core/djangoapps/credit/tests/test_signature.py index 854bdbde68fb184902e7ee32194f03bc91417fd6..88099aaaea5b9265ecab7fc8be9ff3ac83e26d7f 100644 --- a/openedx/core/djangoapps/credit/tests/test_signature.py +++ b/openedx/core/djangoapps/credit/tests/test_signature.py @@ -3,6 +3,8 @@ Tests for digital signatures used to validate messages to/from credit providers. """ +from nose.plugins.attrib import attr + from django.test import TestCase from django.test.utils import override_settings @@ -10,6 +12,7 @@ from django.test.utils import override_settings from openedx.core.djangoapps.credit import signature +@attr('shard_2') @override_settings(CREDIT_PROVIDER_SECRET_KEYS={ "asu": u'abcd1234' }) diff --git a/openedx/core/djangoapps/credit/tests/test_tasks.py b/openedx/core/djangoapps/credit/tests/test_tasks.py index ca41700c0f1faa712a3e41f86b84c9930ea2164d..531b7a294a9e1f88724e620f7783aa408e0f76ef 100644 --- a/openedx/core/djangoapps/credit/tests/test_tasks.py +++ b/openedx/core/djangoapps/credit/tests/test_tasks.py @@ -3,6 +3,7 @@ Tests for credit course tasks. """ import mock +from nose.plugins.attrib import attr from datetime import datetime, timedelta from pytz import UTC @@ -17,6 +18,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, chec from edx_proctoring.api import create_exam +@attr('shard_2') class TestTaskExecution(ModuleStoreTestCase): """Set of tests to ensure that the task code will do the right thing when executed directly. diff --git a/openedx/core/djangoapps/credit/tests/test_verification_access.py b/openedx/core/djangoapps/credit/tests/test_verification_access.py index e7a0db47e6366652ba16c1c7dc5285d2b9a7fc8d..4eb33b8312f9a901e51799dd2d9ac76be4cfa277 100644 --- a/openedx/core/djangoapps/credit/tests/test_verification_access.py +++ b/openedx/core/djangoapps/credit/tests/test_verification_access.py @@ -12,6 +12,7 @@ into verify_student. """ from mock import patch +from nose.plugins.attrib import attr from django.conf import settings @@ -27,6 +28,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, chec from xmodule.partitions.partitions import Group, UserPartition +@attr('shard_2') class CreateVerificationPartitionTest(ModuleStoreTestCase): """ Tests for applying verification access rules. @@ -230,6 +232,7 @@ class CreateVerificationPartitionTest(ModuleStoreTestCase): return None +@attr('shard_2') class WriteOnPublishTest(ModuleStoreTestCase): """ Verify that updates to the course descriptor's diff --git a/openedx/core/djangoapps/credit/tests/test_views.py b/openedx/core/djangoapps/credit/tests/test_views.py index 0d2232dc23e60dbe588b346ff25d5d499d5a0646..2fc3790d8301b372f85a9869f7e78631ab8a654a 100644 --- a/openedx/core/djangoapps/credit/tests/test_views.py +++ b/openedx/core/djangoapps/credit/tests/test_views.py @@ -7,6 +7,7 @@ Tests for credit app views. from __future__ import unicode_literals import datetime import json +from nose.plugins.attrib import attr import unittest import ddt @@ -98,6 +99,7 @@ class ReadOnlyMixin(object): self.assertEqual(response.status_code, 405) +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class CreditCourseViewSetTests(UserMixin, TestCase): """ Tests for the CreditCourse endpoints. @@ -259,6 +261,7 @@ class CreditCourseViewSetTests(UserMixin, TestCase): self.assertTrue(credit_course.enabled) +@attr('shard_2') @ddt.ddt @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class CreditProviderViewSetTests(ApiTestCaseMixin, ReadOnlyMixin, AuthMixin, UserMixin, TestCase): @@ -303,6 +306,7 @@ class CreditProviderViewSetTests(ApiTestCaseMixin, ReadOnlyMixin, AuthMixin, Use self.assertEqual(response.data, CreditProviderSerializer(self.bayside).data) +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class CreditProviderRequestCreateViewTests(ApiTestCaseMixin, UserMixin, TestCase): """ Tests for CreditProviderRequestCreateView. """ @@ -451,6 +455,7 @@ class CreditProviderRequestCreateViewTests(ApiTestCaseMixin, UserMixin, TestCase self.assertEqual(response.status_code, 400) +@attr('shard_2') @ddt.ddt @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class CreditProviderCallbackViewTests(UserMixin, TestCase): @@ -604,6 +609,7 @@ class CreditProviderCallbackViewTests(UserMixin, TestCase): self.assertEqual(response.status_code, 403) +@attr('shard_2') @ddt.ddt @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class CreditEligibilityViewTests(AuthMixin, UserMixin, ReadOnlyMixin, TestCase): diff --git a/openedx/core/djangoapps/models/tests/test_course_details.py b/openedx/core/djangoapps/models/tests/test_course_details.py index 0c2850a539da2929804078feabdb74916ae09d24..46f39982cf7b4f30629a0420b5a7a6d02e0e20ba 100644 --- a/openedx/core/djangoapps/models/tests/test_course_details.py +++ b/openedx/core/djangoapps/models/tests/test_course_details.py @@ -5,6 +5,7 @@ Tests for CourseDetails import datetime import ddt from django.utils.timezone import UTC +from nose.plugins.attrib import attr from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -14,6 +15,7 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from openedx.core.djangoapps.models.course_details import CourseDetails, ABOUT_ATTRIBUTES +@attr('shard_2') @ddt.ddt class CourseDetailsTestCase(ModuleStoreTestCase): """ diff --git a/openedx/core/djangoapps/profile_images/tests/test_images.py b/openedx/core/djangoapps/profile_images/tests/test_images.py index 253394b40b2c3030dcffb06354f84ac82ee3b98f..8291a7b2dd735b1eeb87125a988dd40ad5f060fc 100644 --- a/openedx/core/djangoapps/profile_images/tests/test_images.py +++ b/openedx/core/djangoapps/profile_images/tests/test_images.py @@ -13,6 +13,7 @@ from django.test import TestCase from django.test.utils import override_settings import ddt import mock +from nose.plugins.attrib import attr import piexif from PIL import Image @@ -27,6 +28,7 @@ from ..images import ( from .helpers import make_image_file, make_uploaded_file +@attr('shard_2') @ddt.ddt @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Profile Image API is only supported in LMS') class TestValidateUploadedImage(TestCase): @@ -122,6 +124,7 @@ class TestValidateUploadedImage(TestCase): self.assertEqual(ctx.exception.message, file_upload_bad_mimetype) +@attr('shard_2') @ddt.ddt @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Profile Image API is only supported in LMS') class TestGenerateProfileImages(TestCase): @@ -205,6 +208,7 @@ class TestGenerateProfileImages(TestCase): yield name, image +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Profile Image API is only supported in LMS') class TestRemoveProfileImages(TestCase): """ diff --git a/openedx/core/djangoapps/profile_images/tests/test_views.py b/openedx/core/djangoapps/profile_images/tests/test_views.py index ea82ad2133110233d8554b3a49f7e8dfb7dd8065..812f2d74aba422d57174a52401b36cc5a62a0963 100644 --- a/openedx/core/djangoapps/profile_images/tests/test_views.py +++ b/openedx/core/djangoapps/profile_images/tests/test_views.py @@ -3,6 +3,7 @@ Test cases for the HTTP endpoints of the profile image api. """ from contextlib import closing import datetime +from nose.plugins.attrib import attr from pytz import UTC import unittest @@ -151,6 +152,7 @@ class ProfileImageEndpointMixin(UserSettingsEventTestMixin): self.assert_no_events_were_emitted() +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Profile Image API is only supported in LMS') @mock.patch('openedx.core.djangoapps.profile_images.views.log') class ProfileImageViewGeneralTestCase(ProfileImageEndpointMixin, APITestCase): @@ -170,6 +172,7 @@ class ProfileImageViewGeneralTestCase(ProfileImageEndpointMixin, APITestCase): self.assert_no_events_were_emitted() +@attr('shard_2') @ddt.ddt @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Profile Image API is only supported in LMS') @mock.patch('openedx.core.djangoapps.profile_images.views.log') @@ -380,6 +383,7 @@ class ProfileImageViewPostTestCase(ProfileImageEndpointMixin, APITestCase): self.assert_no_events_were_emitted() +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Profile Image API is only supported in LMS') @mock.patch('openedx.core.djangoapps.profile_images.views.log') class ProfileImageViewDeleteTestCase(ProfileImageEndpointMixin, APITestCase): @@ -510,6 +514,7 @@ class DeprecatedProfileImageTestMixin(ProfileImageEndpointMixin): self.assert_no_events_were_emitted() +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Profile Image API is only supported in LMS') @mock.patch('openedx.core.djangoapps.profile_images.views.log') class DeprecatedProfileImageUploadTestCase(DeprecatedProfileImageTestMixin, APITestCase): @@ -522,6 +527,7 @@ class DeprecatedProfileImageUploadTestCase(DeprecatedProfileImageTestMixin, APIT _replacement_method = 'openedx.core.djangoapps.profile_images.views.ProfileImageView.post' +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Profile Image API is only supported in LMS') @mock.patch('openedx.core.djangoapps.profile_images.views.log') class DeprecatedProfileImageRemoveTestCase(DeprecatedProfileImageTestMixin, APITestCase): diff --git a/openedx/core/djangoapps/programs/tests/test_models.py b/openedx/core/djangoapps/programs/tests/test_models.py index 5f0c3f7cfe99cc6f8ac17299036f6cb5f3fd81d4..6ea3fcba7159c6940ac44ea6971c780ed903a614 100644 --- a/openedx/core/djangoapps/programs/tests/test_models.py +++ b/openedx/core/djangoapps/programs/tests/test_models.py @@ -2,11 +2,13 @@ import ddt from django.test import TestCase import mock +from nose.plugins.attrib import attr from openedx.core.djangoapps.programs.models import ProgramsApiConfig from openedx.core.djangoapps.programs.tests.mixins import ProgramsApiConfigMixin +@attr('shard_2') @ddt.ddt # ConfigurationModels use the cache. Make every cache get a miss. @mock.patch('config_models.models.cache.get', return_value=None) diff --git a/openedx/core/djangoapps/programs/tests/test_signals.py b/openedx/core/djangoapps/programs/tests/test_signals.py index e105f1defaf268b7363020d2703ecca622443e36..5560c3e671a9f597bb41c70967f996843c6c5dd3 100644 --- a/openedx/core/djangoapps/programs/tests/test_signals.py +++ b/openedx/core/djangoapps/programs/tests/test_signals.py @@ -3,6 +3,7 @@ This module contains tests for programs-related signals and signal handlers. """ from django.test import TestCase +from nose.plugins.attrib import attr import mock from student.tests.factories import UserFactory @@ -14,6 +15,7 @@ from openedx.core.djangoapps.programs.signals import handle_course_cert_awarded TEST_USERNAME = 'test-user' +@attr('shard_2') @mock.patch('openedx.core.djangoapps.programs.tasks.v1.tasks.award_program_certificates.delay') @mock.patch( 'openedx.core.djangoapps.programs.models.ProgramsApiConfig.is_certification_enabled', diff --git a/openedx/core/djangoapps/programs/tests/test_utils.py b/openedx/core/djangoapps/programs/tests/test_utils.py index 9703420448631d02bf7d5bff6fb6b026d3187d39..f0f382dc982a53f5c32d10d0a5515d79f3a2aafb 100644 --- a/openedx/core/djangoapps/programs/tests/test_utils.py +++ b/openedx/core/djangoapps/programs/tests/test_utils.py @@ -6,6 +6,7 @@ from django.core.cache import cache from django.test import TestCase import httpretty import mock +from nose.plugins.attrib import attr from oauth2_provider.tests.factories import ClientFactory from provider.constants import CONFIDENTIAL @@ -19,6 +20,7 @@ from student.tests.factories import UserFactory @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') +@attr('shard_2') class TestProgramRetrieval(ProgramsApiConfigMixin, ProgramsDataMixin, CredentialsApiConfigMixin, TestCase): """Tests covering the retrieval of programs from the Programs service.""" diff --git a/openedx/core/djangoapps/safe_sessions/tests/test_middleware.py b/openedx/core/djangoapps/safe_sessions/tests/test_middleware.py index 0aee5ab904f0781f7a236ca18df0903149641487..50e5859ba46cbddbd8200cd70dca2afeadbaf82a 100644 --- a/openedx/core/djangoapps/safe_sessions/tests/test_middleware.py +++ b/openedx/core/djangoapps/safe_sessions/tests/test_middleware.py @@ -12,6 +12,7 @@ from django.test import TestCase from django.test.client import RequestFactory from django.test.utils import override_settings from mock import patch +from nose.plugins.attrib import attr from student.tests.factories import UserFactory @@ -30,6 +31,7 @@ def create_mock_request(): return request +@attr('shard_2') class TestSafeSessionProcessRequest(TestSafeSessionsLogMixin, TestCase): """ Test class for SafeSessionMiddleware.process_request @@ -130,6 +132,7 @@ class TestSafeSessionProcessRequest(TestSafeSessionsLogMixin, TestCase): self.assert_user_in_session() +@attr('shard_2') @ddt.ddt class TestSafeSessionProcessResponse(TestSafeSessionsLogMixin, TestCase): """ @@ -232,6 +235,7 @@ class TestSafeSessionProcessResponse(TestSafeSessionsLogMixin, TestCase): self.assert_response_with_delete_cookie() +@attr('shard_2') @ddt.ddt class TestSafeSessionMiddleware(TestSafeSessionsLogMixin, TestCase): """ diff --git a/openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py b/openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py index 468d9c09b0eb1f03c71d6bb366911ede89136886..d12dfc43d08bb22dbe283995f2ddab9b1f0c0c15 100644 --- a/openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py +++ b/openedx/core/djangoapps/safe_sessions/tests/test_safe_cookie_data.py @@ -7,12 +7,14 @@ import ddt from django.test import TestCase import itertools from mock import patch +from nose.plugins.attrib import attr from time import time from ..middleware import SafeCookieData, SafeCookieError from .test_utils import TestSafeSessionsLogMixin +@attr('shard_2') @ddt.ddt class TestSafeCookieData(TestSafeSessionsLogMixin, TestCase): """ diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_api.py b/openedx/core/djangoapps/user_api/accounts/tests/test_api.py index db086759e80b642fb1bb795795bbcc50d0ac486c..ec2ac28f7a06f93c8164cfc08db697f009be3623 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_api.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_api.py @@ -9,6 +9,7 @@ from dateutil.parser import parse as parse_datetime from mock import Mock, patch from django.test import TestCase +from nose.plugins.attrib import attr from nose.tools import raises import unittest from student.tests.factories import UserFactory @@ -33,6 +34,7 @@ def mock_render_to_string(template_name, context): return str((template_name, sorted(context.iteritems()))) +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Account APIs are only supported in LMS') class TestAccountApi(UserSettingsEventTestMixin, TestCase): """ @@ -230,6 +232,7 @@ class TestAccountApi(UserSettingsEventTestMixin, TestCase): verify_event_emitted([], [{"code": "en"}, {"code": "fr"}]) +@attr('shard_2') @patch('openedx.core.djangoapps.user_api.accounts.image_helpers._PROFILE_IMAGE_SIZES', [50, 10]) @patch.dict( 'openedx.core.djangoapps.user_api.accounts.image_helpers.PROFILE_IMAGE_SIZES_MAP', @@ -282,6 +285,7 @@ class AccountSettingsOnCreationTest(TestCase): }) +@attr('shard_2') @ddt.ddt class AccountCreationActivationAndPasswordChangeTest(TestCase): """ diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py b/openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py index 2a4047627935cf5d86ef2e9529c7ccc13b2717e4..5c8510b341bdca91c217c198539e0495434a2830 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py @@ -4,6 +4,7 @@ Tests for helpers.py import datetime import hashlib from mock import patch +from nose.plugins.attrib import attr from pytz import UTC from unittest import skipUnless @@ -17,6 +18,7 @@ TEST_SIZES = {'full': 50, 'small': 10} TEST_PROFILE_IMAGE_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 01, tzinfo=UTC) +@attr('shard_2') @patch.dict('openedx.core.djangoapps.user_api.accounts.image_helpers.PROFILE_IMAGE_SIZES_MAP', TEST_SIZES, clear=True) @skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class ProfileImageUrlTestCase(TestCase): diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py index e525c14743c7393303264958acb0925e5d4b2871..db6df2fcd9708197efbb52062154dcfda94abbf9 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py @@ -9,6 +9,7 @@ import ddt import hashlib import json from mock import patch +from nose.plugins.attrib import attr from pytz import UTC import unittest @@ -118,6 +119,7 @@ class UserAPITestCase(APITestCase): {'full': 50, 'small': 10}, clear=True ) +@attr('shard_2') class TestAccountAPI(UserAPITestCase): """ Unit tests for the Account API. @@ -717,6 +719,7 @@ class TestAccountAPI(UserAPITestCase): ) +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class TestAccountAPITransactions(TransactionTestCase): """ diff --git a/openedx/core/djangoapps/user_api/course_tag/tests/test_api.py b/openedx/core/djangoapps/user_api/course_tag/tests/test_api.py index ca4422658b32a4d6e7260f0174026bd079d319f7..83a75469e839d5c3c6e03e65ceb48c4d9e8e8a5b 100644 --- a/openedx/core/djangoapps/user_api/course_tag/tests/test_api.py +++ b/openedx/core/djangoapps/user_api/course_tag/tests/test_api.py @@ -4,10 +4,12 @@ Test the user course tag API. from django.test import TestCase from student.tests.factories import UserFactory +from nose.plugins.attrib import attr from openedx.core.djangoapps.user_api.course_tag import api as course_tag_api from opaque_keys.edx.locations import SlashSeparatedCourseKey +@attr('shard_2') class TestCourseTagAPI(TestCase): """ Test the user service diff --git a/openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py b/openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py index 9ea502a166dad54ac0aa0755a4f82641fa1ce0d7..ca8f54ea428723db2921fa402139ffd267f28ffc 100644 --- a/openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py +++ b/openedx/core/djangoapps/user_api/management/tests/test_email_opt_in_list.py @@ -5,6 +5,7 @@ import tempfile import shutil import csv from collections import defaultdict +from nose.plugins.attrib import attr from unittest import skipUnless import ddt @@ -21,6 +22,7 @@ from openedx.core.djangoapps.user_api.models import UserOrgTag from openedx.core.djangoapps.user_api.management.commands import email_opt_in_list +@attr('shard_2') @ddt.ddt @skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class EmailOptInListTest(ModuleStoreTestCase): diff --git a/openedx/core/djangoapps/user_api/preferences/tests/test_api.py b/openedx/core/djangoapps/user_api/preferences/tests/test_api.py index 2bdc1680bd2950d2b618649c2c9199b756bc5b97..682d9b08280a52a80046c087669ddabc5526f929 100644 --- a/openedx/core/djangoapps/user_api/preferences/tests/test_api.py +++ b/openedx/core/djangoapps/user_api/preferences/tests/test_api.py @@ -6,6 +6,7 @@ import datetime import ddt import unittest from mock import patch +from nose.plugins.attrib import attr from pytz import UTC from django.conf import settings @@ -28,6 +29,7 @@ from ...preferences.api import ( ) +@attr('shard_2') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Account APIs are only supported in LMS') class TestPreferenceAPI(TestCase): """ @@ -319,6 +321,7 @@ class TestPreferenceAPI(TestCase): ) +@attr('shard_2') @ddt.ddt class UpdateEmailOptInTests(ModuleStoreTestCase): """ diff --git a/openedx/core/djangolib/tests/test_js_utils.py b/openedx/core/djangolib/tests/test_js_utils.py index 6bfb51476c88b2ce305bd352c6b96e844f6edec1..566db3cc433d32be84d5b30a4a5ed5f737202cb9 100644 --- a/openedx/core/djangolib/tests/test_js_utils.py +++ b/openedx/core/djangolib/tests/test_js_utils.py @@ -3,6 +3,7 @@ Tests for js_utils.py """ import json +from nose.plugins.attrib import attr from unittest import TestCase import HTMLParser @@ -13,6 +14,7 @@ from openedx.core.djangolib.js_utils import ( ) +@attr('shard_2') class TestJSUtils(TestCase): """ Test JS utils diff --git a/openedx/core/djangolib/tests/test_markup.py b/openedx/core/djangolib/tests/test_markup.py index e0a7b603b7a7afd705f3145b7840e52233fd740c..30c7403b7b7777aca81afd2398aa4b1cdf59c150 100644 --- a/openedx/core/djangolib/tests/test_markup.py +++ b/openedx/core/djangolib/tests/test_markup.py @@ -3,6 +3,7 @@ Tests for openedx.core.djangolib.markup """ +from nose.plugins.attrib import attr import unittest import ddt @@ -12,6 +13,7 @@ from mako.template import Template from openedx.core.djangolib.markup import Text, HTML +@attr('shard_2') @ddt.ddt class FormatHtmlTest(unittest.TestCase): """Test that we can format plain strings and HTML into them properly.""" diff --git a/openedx/core/lib/api/tests/test_authentication.py b/openedx/core/lib/api/tests/test_authentication.py index 1e1091b3eb3be17bb41abc2e84f40853fb66fdb6..ea572b841bd2bd6e777e70dc0376ff8de47ffe43 100644 --- a/openedx/core/lib/api/tests/test_authentication.py +++ b/openedx/core/lib/api/tests/test_authentication.py @@ -18,6 +18,7 @@ from django.test import TestCase from django.utils import unittest from django.utils.http import urlencode from mock import patch +from nose.plugins.attrib import attr from rest_framework import exceptions from rest_framework import status from rest_framework.permissions import IsAuthenticated @@ -75,6 +76,7 @@ urlpatterns = patterns( ) +@attr('shard_2') @ddt.ddt class OAuth2Tests(TestCase): """OAuth 2.0 authentication""" @@ -292,6 +294,7 @@ class OAuth2Tests(TestCase): self.assertEqual(response.status_code, scope_statuses.write_status) +@attr('shard_2') @ddt.ddt @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class TestJWTAuthToggle(JwtMixin, TestCase): diff --git a/openedx/core/lib/api/tests/test_exceptions.py b/openedx/core/lib/api/tests/test_exceptions.py index 9ce559b797a5719cfc82f76cf9fbc2a3e7f4bc26..e354d06400fc4f81dd8bfc5f17dba8704c3625cd 100644 --- a/openedx/core/lib/api/tests/test_exceptions.py +++ b/openedx/core/lib/api/tests/test_exceptions.py @@ -3,11 +3,13 @@ Test Custom Exceptions """ import ddt from django.test import TestCase +from nose.plugins.attrib import attr from rest_framework import exceptions as drf_exceptions from .. import exceptions +@attr('shard_2') @ddt.ddt class TestDictExceptionsAllowDictDetails(TestCase): """ @@ -44,6 +46,7 @@ class TestDictExceptionsAllowDictDetails(TestCase): self.assertEqual(exc.available_renderers, ['application/json']) +@attr('shard_2') @ddt.ddt class TestDictExceptionSubclassing(TestCase): """ diff --git a/openedx/core/lib/api/tests/test_paginators.py b/openedx/core/lib/api/tests/test_paginators.py index bc6d2340309eb8da19f312d41c84c2e8f8b44df8..dfdc3aaba9e182a5e140b1aeb828d5249d378f8c 100644 --- a/openedx/core/lib/api/tests/test_paginators.py +++ b/openedx/core/lib/api/tests/test_paginators.py @@ -4,6 +4,7 @@ from collections import namedtuple import ddt from mock import Mock, MagicMock +from nose.plugins.attrib import attr from unittest import TestCase from django.http import Http404 from django.test import RequestFactory @@ -12,6 +13,7 @@ from rest_framework import serializers from openedx.core.lib.api.paginators import NamespacedPageNumberPagination, paginate_search_results +@attr('shard_2') @ddt.ddt class PaginateSearchResultsTestCase(TestCase): """Test cases for paginate_search_results method""" @@ -122,6 +124,7 @@ class PaginateSearchResultsTestCase(TestCase): paginate_search_results(self.mock_model, self.search_results, self.default_size, page_num) +@attr('shard_2') class NamespacedPaginationTestCase(TestCase): """ Test behavior of `NamespacedPageNumberPagination` diff --git a/openedx/core/lib/api/tests/test_parsers.py b/openedx/core/lib/api/tests/test_parsers.py index 6245b23dc4f40085dbcd5c607dd9efef08d988e6..fb6722bc4625a2e6209d23dfc8c76df48bbec1a0 100644 --- a/openedx/core/lib/api/tests/test_parsers.py +++ b/openedx/core/lib/api/tests/test_parsers.py @@ -3,6 +3,7 @@ TestCases verifying proper behavior of custom DRF request parsers. """ from collections import namedtuple +from nose.plugins.attrib import attr from io import BytesIO from rest_framework import exceptions @@ -11,6 +12,7 @@ from rest_framework.test import APITestCase, APIRequestFactory from openedx.core.lib.api import parsers +@attr('shard_2') class TestTypedFileUploadParser(APITestCase): """ Tests that verify the behavior of TypedFileUploadParser diff --git a/openedx/core/lib/api/tests/test_permissions.py b/openedx/core/lib/api/tests/test_permissions.py index f44b60f1f9268778fc10ef7cec146871cda2574a..bc121d32f5e5e1e42cf0a2d4dd64090b335235da 100644 --- a/openedx/core/lib/api/tests/test_permissions.py +++ b/openedx/core/lib/api/tests/test_permissions.py @@ -4,6 +4,7 @@ import ddt from django.contrib.auth.models import AnonymousUser from django.http import Http404 from django.test import TestCase, RequestFactory +from nose.plugins.attrib import attr from student.roles import CourseStaffRole, CourseInstructorRole from openedx.core.lib.api.permissions import ( @@ -29,6 +30,7 @@ class TestCcxObject(TestObject): self.coach = user +@attr('shard_2') class IsCourseStaffInstructorTests(TestCase): """ Test for IsCourseStaffInstructor permission class. """ @@ -62,6 +64,7 @@ class IsCourseStaffInstructorTests(TestCase): self.assertFalse(self.permission.has_object_permission(self.request, None, self.obj)) +@attr('shard_2') class IsMasterCourseStaffInstructorTests(TestCase): """ Test for IsMasterCourseStaffInstructorTests permission class. """ @@ -106,6 +109,7 @@ class IsMasterCourseStaffInstructorTests(TestCase): self.permission.has_permission(post_request, None) +@attr('shard_2') @ddt.ddt class IsStaffOrOwnerTests(TestCase): """ Tests for IsStaffOrOwner permission class. """ diff --git a/openedx/core/lib/block_structure/tests/test_block_structure.py b/openedx/core/lib/block_structure/tests/test_block_structure.py index d1362dabbfd3c9028f56dc3d669c88fc346b3222..ebca1030022408b9a93f2f3b362547dd71d3f5b4 100644 --- a/openedx/core/lib/block_structure/tests/test_block_structure.py +++ b/openedx/core/lib/block_structure/tests/test_block_structure.py @@ -6,6 +6,7 @@ from collections import namedtuple from copy import deepcopy import ddt import itertools +from nose.plugins.attrib import attr from unittest import TestCase from openedx.core.lib.graph_traversals import traverse_post_order @@ -15,6 +16,7 @@ from ..exceptions import TransformerException from .helpers import MockXBlock, MockTransformer, ChildrenMapTestMixin +@attr('shard_2') @ddt.ddt class TestBlockStructure(TestCase, ChildrenMapTestMixin): """ @@ -43,6 +45,7 @@ class TestBlockStructure(TestCase, ChildrenMapTestMixin): self.assertNotIn(len(children_map) + 1, block_structure) +@attr('shard_2') @ddt.ddt class TestBlockStructureData(TestCase, ChildrenMapTestMixin): """ diff --git a/openedx/core/lib/block_structure/tests/test_cache.py b/openedx/core/lib/block_structure/tests/test_cache.py index 6654cbab9e9432851052ac707ecf0ea8b47c0f02..c6dd917e01eb840a0630defad46775c3f8ac28cb 100644 --- a/openedx/core/lib/block_structure/tests/test_cache.py +++ b/openedx/core/lib/block_structure/tests/test_cache.py @@ -1,12 +1,14 @@ """ Tests for block_structure/cache.py """ +from nose.plugins.attrib import attr from unittest import TestCase from ..cache import BlockStructureCache from .helpers import ChildrenMapTestMixin, MockCache, MockTransformer +@attr('shard_2') class TestBlockStructureCache(ChildrenMapTestMixin, TestCase): """ Tests for BlockStructureFactory diff --git a/openedx/core/lib/block_structure/tests/test_factory.py b/openedx/core/lib/block_structure/tests/test_factory.py index c7c6e69c3d706ad5e716b0d515b2090eae8f19cd..1530f658814b0fe1833d94c4467d33dfc853332f 100644 --- a/openedx/core/lib/block_structure/tests/test_factory.py +++ b/openedx/core/lib/block_structure/tests/test_factory.py @@ -1,6 +1,7 @@ """ Tests for block_structure_factory.py """ +from nose.plugins.attrib import attr from unittest import TestCase from xmodule.modulestore.exceptions import ItemNotFoundError @@ -11,6 +12,7 @@ from .helpers import ( ) +@attr('shard_2') class TestBlockStructureFactory(TestCase, ChildrenMapTestMixin): """ Tests for BlockStructureFactory diff --git a/openedx/core/lib/block_structure/tests/test_manager.py b/openedx/core/lib/block_structure/tests/test_manager.py index 19ea53e5de376da907a5ccd012df071ea9ec226f..5c32d6b08b9e4060ba8aed7e575551d75e3bac58 100644 --- a/openedx/core/lib/block_structure/tests/test_manager.py +++ b/openedx/core/lib/block_structure/tests/test_manager.py @@ -1,6 +1,7 @@ """ Tests for manager.py """ +from nose.plugins.attrib import attr from unittest import TestCase from ..exceptions import UsageKeyNotInBlockStructure @@ -83,6 +84,7 @@ class TestTransformer1(MockTransformer): return data_key + 't1.val1.' + unicode(block_key) +@attr('shard_2') class TestBlockStructureManager(TestCase, ChildrenMapTestMixin): """ Test class for BlockStructureManager. diff --git a/openedx/core/lib/block_structure/tests/test_transformer_registry.py b/openedx/core/lib/block_structure/tests/test_transformer_registry.py index 008ed8f3bc65975d1ef7655c5805785a8165554e..5e6db93cff4fa393cf35209c2e68bd075af0e5d3 100644 --- a/openedx/core/lib/block_structure/tests/test_transformer_registry.py +++ b/openedx/core/lib/block_structure/tests/test_transformer_registry.py @@ -3,6 +3,7 @@ Tests for transformer_registry.py """ import ddt +from nose.plugins.attrib import attr from unittest import TestCase from ..transformer_registry import TransformerRegistry @@ -30,6 +31,7 @@ class UnregisteredTestTransformer3(MockTransformer): pass +@attr('shard_2') @ddt.ddt class TransformerRegistryTestCase(TestCase): """ diff --git a/openedx/core/lib/block_structure/tests/test_transformers.py b/openedx/core/lib/block_structure/tests/test_transformers.py index 2b77ab16e30c7a4b7458b1a5295ec733f358c048..06498ba17f7eb34d5f50a5989d36982b537fe8ca 100644 --- a/openedx/core/lib/block_structure/tests/test_transformers.py +++ b/openedx/core/lib/block_structure/tests/test_transformers.py @@ -2,6 +2,7 @@ Tests for transformers.py """ from mock import MagicMock, patch +from nose.plugins.attrib import attr from unittest import TestCase from ..block_structure import BlockStructureModulestoreData @@ -12,6 +13,7 @@ from .helpers import ( ) +@attr('shard_2') class TestBlockStructureTransformers(ChildrenMapTestMixin, TestCase): """ Test class for testing BlockStructureTransformers diff --git a/openedx/core/lib/gating/tests/test_api.py b/openedx/core/lib/gating/tests/test_api.py index 4854ea71a384214c93d31495f1a5a13d7803181c..172555fdd05cbd1247e470e4c3693b8319f1edef 100644 --- a/openedx/core/lib/gating/tests/test_api.py +++ b/openedx/core/lib/gating/tests/test_api.py @@ -2,6 +2,7 @@ Tests for the gating API """ from mock import patch, MagicMock +from nose.plugins.attrib import attr from ddt import ddt, data from milestones.tests.utils import MilestonesTestCaseMixin from milestones import api as milestones_api @@ -11,6 +12,7 @@ from openedx.core.lib.gating import api as gating_api from openedx.core.lib.gating.exceptions import GatingValidationError +@attr('shard_2') @ddt @patch.dict('django.conf.settings.FEATURES', {'MILESTONES_APP': True}) class TestGatingApi(ModuleStoreTestCase, MilestonesTestCaseMixin): diff --git a/openedx/core/lib/tests/test_course_tab_api.py b/openedx/core/lib/tests/test_course_tab_api.py index e6cc09f1f090c763ea9391f81000191128a74254..ffd42328a416886147e444bc7caf4de3e7cb594e 100644 --- a/openedx/core/lib/tests/test_course_tab_api.py +++ b/openedx/core/lib/tests/test_course_tab_api.py @@ -3,11 +3,13 @@ Tests for the plugin API """ from django.test import TestCase +from nose.plugins.attrib import attr from openedx.core.lib.api.plugins import PluginError from openedx.core.lib.course_tabs import CourseTabPluginManager +@attr('shard_2') class TestPluginApi(TestCase): """ Unit tests for the plugin API diff --git a/openedx/core/lib/tests/test_course_tabs.py b/openedx/core/lib/tests/test_course_tabs.py index 6bb56e1c89eea9ac8a371860ade01d7342dc29b9..c11619369b5e4d5d11adea3c1784f512f2eccbd4 100644 --- a/openedx/core/lib/tests/test_course_tabs.py +++ b/openedx/core/lib/tests/test_course_tabs.py @@ -1,6 +1,7 @@ """ Tests of specific tabs. """ from mock import patch, Mock +from nose.plugins.attrib import attr from unittest import TestCase import xmodule.tabs as xmodule_tabs @@ -8,6 +9,7 @@ import xmodule.tabs as xmodule_tabs from openedx.core.lib.course_tabs import CourseTabPluginManager +@attr('shard_2') class CourseTabPluginManagerTestCase(TestCase): """Test cases for CourseTabPluginManager class""" @@ -37,6 +39,7 @@ class CourseTabPluginManagerTestCase(TestCase): ) +@attr('shard_2') class KeyCheckerTestCase(TestCase): """Test cases for KeyChecker class""" @@ -55,6 +58,7 @@ class KeyCheckerTestCase(TestCase): xmodule_tabs.key_checker(self.invalid_keys)(self.dict_value) +@attr('shard_2') class NeedNameTestCase(TestCase): """Test cases for NeedName validator""" diff --git a/openedx/core/lib/tests/test_courses.py b/openedx/core/lib/tests/test_courses.py index 690d4f1d492cfec985cbbdba4b24154bde20ccc3..696f9e503b5d110e831d7e171d60db7cbbef0de2 100644 --- a/openedx/core/lib/tests/test_courses.py +++ b/openedx/core/lib/tests/test_courses.py @@ -4,6 +4,7 @@ Tests for functionality in openedx/core/lib/courses.py. import ddt from django.test.utils import override_settings +from nose.plugins.attrib import attr from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.factories import CourseFactory @@ -12,6 +13,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from ..courses import course_image_url +@attr('shard_2') @ddt.ddt class CourseImageTestCase(ModuleStoreTestCase): """Tests for course image URLs.""" diff --git a/openedx/core/lib/tests/test_edx_api_utils.py b/openedx/core/lib/tests/test_edx_api_utils.py index 11eab1db1d004d95d0a52f1a7dde94eec614cba9..ca62f850e5811fd50e34fbbdf438519c7d464c5b 100644 --- a/openedx/core/lib/tests/test_edx_api_utils.py +++ b/openedx/core/lib/tests/test_edx_api_utils.py @@ -6,6 +6,7 @@ from django.core.cache import cache from django.test import TestCase import httpretty import mock +from nose.plugins.attrib import attr from oauth2_provider.tests.factories import ClientFactory from provider.constants import CONFIDENTIAL from testfixtures import LogCapture @@ -21,6 +22,7 @@ from student.tests.factories import UserFactory LOGGER_NAME = 'openedx.core.lib.edx_api_utils' +@attr('shard_2') class TestApiDataRetrieval(CredentialsApiConfigMixin, CredentialsDataMixin, ProgramsApiConfigMixin, ProgramsDataMixin, TestCase): """Test utility for API data retrieval.""" diff --git a/openedx/core/lib/tests/test_graph_traversals.py b/openedx/core/lib/tests/test_graph_traversals.py index 840b05be88bf11296908da8bc15f8fd23ef9d22a..3e9ac96ee2dbf282171be4eca976ab59876a017b 100644 --- a/openedx/core/lib/tests/test_graph_traversals.py +++ b/openedx/core/lib/tests/test_graph_traversals.py @@ -3,6 +3,7 @@ Tests for graph traversal generator functions. """ from collections import defaultdict +from nose.plugins.attrib import attr from unittest import TestCase from ..graph_traversals import ( @@ -10,6 +11,7 @@ from ..graph_traversals import ( ) +@attr('shard_2') class TestGraphTraversals(TestCase): """ Test Class for graph traversal generator functions. diff --git a/openedx/core/lib/tests/test_token_utils.py b/openedx/core/lib/tests/test_token_utils.py index 662d5fc5dcbd3fc343114af5c2aa8fbeed790f00..495e4eebc4420f531808ae6b2ce1da5407463147 100644 --- a/openedx/core/lib/tests/test_token_utils.py +++ b/openedx/core/lib/tests/test_token_utils.py @@ -9,6 +9,7 @@ from django.test import TestCase from django.test.utils import override_settings import freezegun import jwt +from nose.plugins.attrib import attr from oauth2_provider.tests.factories import ClientFactory from provider.constants import CONFIDENTIAL @@ -17,6 +18,7 @@ from student.models import anonymous_id_for_user from student.tests.factories import UserFactory, UserProfileFactory +@attr('shard_2') @ddt.ddt class TestIdTokenGeneration(TestCase): """Tests covering ID token generation.""" diff --git a/openedx/core/lib/tests/test_xblock_utils.py b/openedx/core/lib/tests/test_xblock_utils.py index a9b23f66a3319df9862560b47cf29b194613b0b3..b2d206d7f45cd1bbb7ff09f05d50ab9a165883ec 100644 --- a/openedx/core/lib/tests/test_xblock_utils.py +++ b/openedx/core/lib/tests/test_xblock_utils.py @@ -4,6 +4,7 @@ Tests for xblock_utils.py from __future__ import unicode_literals, absolute_import import ddt +from nose.plugins.attrib import attr import uuid from django.test.client import RequestFactory @@ -27,6 +28,7 @@ from openedx.core.lib.xblock_utils import ( ) +@attr('shard_2') @ddt.ddt class TestXblockUtils(SharedModuleStoreTestCase): """ diff --git a/scripts/generic-ci-tests.sh b/scripts/generic-ci-tests.sh index 136c40f4720ac93b764c65bcae43aa5846356aca..e9519a8836827244f9f39d035a134c2b83b9bef2 100755 --- a/scripts/generic-ci-tests.sh +++ b/scripts/generic-ci-tests.sh @@ -94,7 +94,10 @@ END paver test_system -s lms --extra_args="--attr='shard_1' --with-flaky" --cov_args="-p" ;; "2") - paver test_system -s lms --extra_args="--attr='shard_1=False' --with-flaky" --cov_args="-p" + paver test_system -s lms --extra_args="--attr='shard_2' --with-flaky" --cov_args="-p" + ;; + "3") + paver test_system -s lms --extra_args="--attr='shard_1=False,shard_2=False' --with-flaky" --cov_args="-p" ;; *) paver test_system -s lms --extra_args="--with-flaky" --cov_args="-p"