diff --git a/lms/djangoapps/course_api/blocks/transformers/tests/test_milestones.py b/lms/djangoapps/course_api/blocks/transformers/tests/test_milestones.py index 7366cd3609..115e69fcde 100644 --- a/lms/djangoapps/course_api/blocks/transformers/tests/test_milestones.py +++ b/lms/djangoapps/course_api/blocks/transformers/tests/test_milestones.py @@ -4,7 +4,6 @@ Tests for ProctoredExamTransformer. import ddt from milestones.tests.utils import MilestonesTestCaseMixin from mock import Mock, patch -from nose.plugins.attrib import attr from gating import api as lms_gating_api from lms.djangoapps.course_blocks.api import get_course_blocks @@ -16,7 +15,6 @@ from student.tests.factories import CourseEnrollmentFactory from ..milestones import MilestonesAndSpecialExamsTransformer -@attr(shard=3) @ddt.ddt @patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True}) class MilestonesTransformerTestCase(CourseStructureTestCase, MilestonesTestCaseMixin): @@ -24,6 +22,7 @@ class MilestonesTransformerTestCase(CourseStructureTestCase, MilestonesTestCaseM Test behavior of ProctoredExamTransformer """ TRANSFORMER_CLASS_TO_TEST = MilestonesAndSpecialExamsTransformer + shard = 3 def setUp(self): """ diff --git a/lms/djangoapps/course_api/tests/test_serializers.py b/lms/djangoapps/course_api/tests/test_serializers.py index 179df69e9b..dac4f2bab5 100644 --- a/lms/djangoapps/course_api/tests/test_serializers.py +++ b/lms/djangoapps/course_api/tests/test_serializers.py @@ -7,7 +7,6 @@ from __future__ import unicode_literals from datetime import datetime import ddt -from nose.plugins.attrib import attr from rest_framework.request import Request from rest_framework.test import APIRequestFactory from xblock.core import XBlock @@ -22,7 +21,6 @@ from ..serializers import CourseDetailSerializer, CourseSerializer from .mixins import CourseApiFactoryMixin -@attr(shard=3) @ddt.ddt class TestCourseSerializer(CourseApiFactoryMixin, ModuleStoreTestCase): """ @@ -31,6 +29,7 @@ class TestCourseSerializer(CourseApiFactoryMixin, ModuleStoreTestCase): expected_mongo_calls = 0 maxDiff = 5000 # long enough to show mismatched dicts, in case of error serializer_class = CourseSerializer + shard = 3 ENABLED_SIGNALS = ['course_published'] diff --git a/lms/djangoapps/course_api/tests/test_views.py b/lms/djangoapps/course_api/tests/test_views.py index 2f545521ca..26d74e02b4 100644 --- a/lms/djangoapps/course_api/tests/test_views.py +++ b/lms/djangoapps/course_api/tests/test_views.py @@ -8,11 +8,11 @@ from django.core.exceptions import ImproperlyConfigured from django.urls import reverse from django.test import RequestFactory from django.test.utils import override_settings -from nose.plugins.attrib import attr from search.tests.test_course_discovery import DemoCourse from search.tests.tests import TEST_INDEX_NAME from search.tests.utils import SearcherMixin +from openedx.core.lib.tests import attr from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase from waffle.testutils import override_switch diff --git a/lms/djangoapps/course_blocks/transformers/tests/test_hidden_content.py b/lms/djangoapps/course_blocks/transformers/tests/test_hidden_content.py index 86032ec368..f90fb01cba 100644 --- a/lms/djangoapps/course_blocks/transformers/tests/test_hidden_content.py +++ b/lms/djangoapps/course_blocks/transformers/tests/test_hidden_content.py @@ -5,13 +5,11 @@ from datetime import timedelta import ddt from django.utils.timezone import now -from nose.plugins.attrib import attr from ..hidden_content import HiddenContentTransformer from .helpers import BlockParentsMapTestCase, update_block -@attr(shard=3) @ddt.ddt class HiddenContentTransformerTestCase(BlockParentsMapTestCase): """ @@ -19,6 +17,7 @@ class HiddenContentTransformerTestCase(BlockParentsMapTestCase): """ TRANSFORMER_CLASS_TO_TEST = HiddenContentTransformer ALL_BLOCKS = {0, 1, 2, 3, 4, 5, 6} + shard = 3 class DueDateType(object): """ diff --git a/lms/djangoapps/course_blocks/transformers/tests/test_split_test.py b/lms/djangoapps/course_blocks/transformers/tests/test_split_test.py index 7cfe10f442..8ac4e5b955 100644 --- a/lms/djangoapps/course_blocks/transformers/tests/test_split_test.py +++ b/lms/djangoapps/course_blocks/transformers/tests/test_split_test.py @@ -2,7 +2,6 @@ Tests for SplitTestTransformer. """ import ddt -from nose.plugins.attrib import attr import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme @@ -15,7 +14,6 @@ from ..user_partitions import UserPartitionTransformer, _get_user_partition_grou from .helpers import CourseStructureTestCase, create_location -@attr(shard=3) @ddt.ddt class SplitTestTransformerTestCase(CourseStructureTestCase): """ @@ -23,6 +21,7 @@ class SplitTestTransformerTestCase(CourseStructureTestCase): """ TEST_PARTITION_ID = 0 TRANSFORMER_CLASS_TO_TEST = UserPartitionTransformer + shard = 3 def setUp(self): """ diff --git a/lms/djangoapps/course_blocks/transformers/tests/test_start_date.py b/lms/djangoapps/course_blocks/transformers/tests/test_start_date.py index a4cb0b5d3a..a9ddea6c0b 100644 --- a/lms/djangoapps/course_blocks/transformers/tests/test_start_date.py +++ b/lms/djangoapps/course_blocks/transformers/tests/test_start_date.py @@ -6,7 +6,6 @@ from datetime import timedelta import ddt from django.utils.timezone import now from mock import patch -from nose.plugins.attrib import attr from courseware.tests.factories import BetaTesterFactory @@ -14,7 +13,6 @@ from ..start_date import DEFAULT_START_DATE, StartDateTransformer from .helpers import BlockParentsMapTestCase, update_block -@attr(shard=3) @ddt.ddt class StartDateTransformerTestCase(BlockParentsMapTestCase): """ @@ -23,6 +21,7 @@ class StartDateTransformerTestCase(BlockParentsMapTestCase): STUDENT = 1 BETA_USER = 2 TRANSFORMER_CLASS_TO_TEST = StartDateTransformer + shard = 3 class StartDateType(object): """ diff --git a/lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py b/lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py index 8b97a55b9e..aa1912c34d 100644 --- a/lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py +++ b/lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py @@ -6,7 +6,6 @@ import string from collections import namedtuple import ddt -from nose.plugins.attrib import attr from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort from openedx.core.djangoapps.course_groups.partition_scheme import CohortPartitionScheme @@ -69,12 +68,13 @@ class UserPartitionTestMixin(object): self.partition_cohorts.append(partition_cohorts) -@attr(shard=3) @ddt.ddt class UserPartitionTransformerTestCase(UserPartitionTestMixin, CourseStructureTestCase): """ UserPartitionTransformer Test """ + shard = 3 + def setup_partitions_and_course(self, active=True): """ Setup course structure and create user for user partition @@ -242,12 +242,13 @@ class UserPartitionTransformerTestCase(UserPartitionTestMixin, CourseStructureTe ) -@attr(shard=3) @ddt.ddt class MergedGroupAccessTestData(UserPartitionTestMixin, CourseStructureTestCase): """ _MergedGroupAccess Test """ + shard = 3 + def setUp(self): """ Setup course structure and create user for user partition diff --git a/lms/djangoapps/course_blocks/transformers/tests/test_visibility.py b/lms/djangoapps/course_blocks/transformers/tests/test_visibility.py index 9bc1d01c9e..bcdd3ebab5 100644 --- a/lms/djangoapps/course_blocks/transformers/tests/test_visibility.py +++ b/lms/djangoapps/course_blocks/transformers/tests/test_visibility.py @@ -2,19 +2,18 @@ Tests for VisibilityTransformer. """ import ddt -from nose.plugins.attrib import attr from ..visibility import VisibilityTransformer from .helpers import BlockParentsMapTestCase, update_block -@attr(shard=3) @ddt.ddt class VisibilityTransformerTestCase(BlockParentsMapTestCase): """ VisibilityTransformer Test """ TRANSFORMER_CLASS_TO_TEST = VisibilityTransformer + shard = 3 # Following test cases are based on BlockParentsMapTestCase.parents_map @ddt.data( diff --git a/lms/djangoapps/course_wiki/tests/test_access.py b/lms/djangoapps/course_wiki/tests/test_access.py index c574648641..c075979414 100644 --- a/lms/djangoapps/course_wiki/tests/test_access.py +++ b/lms/djangoapps/course_wiki/tests/test_access.py @@ -3,13 +3,13 @@ Tests for wiki permissions """ from django.contrib.auth.models import Group -from nose.plugins.attrib import attr from wiki.models import URLPath from course_wiki import settings from course_wiki.utils import course_wiki_slug, user_is_article_course_staff from course_wiki.views import get_or_create_root from courseware.tests.factories import InstructorFactory, StaffFactory +from openedx.core.lib.tests import attr from student.tests.factories import UserFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory diff --git a/lms/djangoapps/course_wiki/tests/test_comprehensive_theming.py b/lms/djangoapps/course_wiki/tests/test_comprehensive_theming.py index 149bdfdb04..b01baebef7 100644 --- a/lms/djangoapps/course_wiki/tests/test_comprehensive_theming.py +++ b/lms/djangoapps/course_wiki/tests/test_comprehensive_theming.py @@ -4,7 +4,6 @@ Tests for wiki middleware. from unittest import skip from django.test.client import Client -from nose.plugins.attrib import attr from wiki.models import URLPath from course_wiki.views import get_or_create_root @@ -14,9 +13,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) class TestComprehensiveTheming(ModuleStoreTestCase): """Tests for comprehensive theming of wiki pages.""" + shard = 1 def setUp(self): """Test setup.""" diff --git a/lms/djangoapps/course_wiki/tests/test_middleware.py b/lms/djangoapps/course_wiki/tests/test_middleware.py index 4ad9a36b00..c0d6209073 100644 --- a/lms/djangoapps/course_wiki/tests/test_middleware.py +++ b/lms/djangoapps/course_wiki/tests/test_middleware.py @@ -3,7 +3,6 @@ Tests for wiki middleware. """ from django.test.client import Client -from nose.plugins.attrib import attr from wiki.models import URLPath from course_wiki.views import get_or_create_root @@ -12,9 +11,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) class TestWikiAccessMiddleware(ModuleStoreTestCase): """Tests for WikiAccessMiddleware.""" + shard = 1 def setUp(self): """Test setup.""" diff --git a/lms/djangoapps/course_wiki/tests/tests.py b/lms/djangoapps/course_wiki/tests/tests.py index 6a060edb11..f8e1fba275 100644 --- a/lms/djangoapps/course_wiki/tests/tests.py +++ b/lms/djangoapps/course_wiki/tests/tests.py @@ -4,7 +4,6 @@ Tests for course wiki from django.urls import reverse from mock import patch -from nose.plugins.attrib import attr from six import text_type from courseware.tests.tests import LoginEnrollmentTestCase @@ -13,11 +12,11 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) class WikiRedirectTestCase(EnterpriseTestConsentRequired, LoginEnrollmentTestCase, ModuleStoreTestCase): """ Tests for wiki course redirection. """ + shard = 1 def setUp(self): super(WikiRedirectTestCase, self).setUp() 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 1d10f6f10e..d8b60c4928 100644 --- a/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py +++ b/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py @@ -7,7 +7,6 @@ Tests for Django management commands import json from StringIO import StringIO -from nose.plugins.attrib import attr from six import text_type import factory @@ -27,7 +26,6 @@ DATA_DIR = settings.COMMON_TEST_DATA_ROOT XML_COURSE_DIRS = ['simple'] -@attr(shard=1) class CommandsTestBase(SharedModuleStoreTestCase): """ Base class for testing different django commands. @@ -39,6 +37,7 @@ class CommandsTestBase(SharedModuleStoreTestCase): __test__ = False url_name = '2012_Fall' ENABLED_SIGNALS = ['course_published'] + shard = 1 @classmethod def setUpClass(cls): diff --git a/lms/djangoapps/courseware/tests/test_about.py b/lms/djangoapps/courseware/tests/test_about.py index 88350f45b3..cfa69b58ae 100644 --- a/lms/djangoapps/courseware/tests/test_about.py +++ b/lms/djangoapps/courseware/tests/test_about.py @@ -10,12 +10,12 @@ from django.urls import reverse from django.test.utils import override_settings from milestones.tests.utils import MilestonesTestCaseMixin from mock import patch -from nose.plugins.attrib import attr from six import text_type from waffle.testutils import override_switch from course_modes.models import CourseMode from lms.djangoapps.ccx.tests.factories import CcxFactory +from openedx.core.lib.tests import attr from openedx.features.course_experience.waffle import WAFFLE_NAMESPACE as COURSE_EXPERIENCE_WAFFLE_NAMESPACE from openedx.features.course_experience.waffle import ENABLE_COURSE_ABOUT_SIDEBAR_HTML from shoppingcart.models import Order, PaidCourseRegistration diff --git a/lms/djangoapps/courseware/tests/test_access.py b/lms/djangoapps/courseware/tests/test_access.py index 6dabede671..260101cb74 100644 --- a/lms/djangoapps/courseware/tests/test_access.py +++ b/lms/djangoapps/courseware/tests/test_access.py @@ -14,7 +14,6 @@ from django.test import TestCase from django.test.client import RequestFactory from milestones.tests.utils import MilestonesTestCaseMixin from mock import Mock, patch -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator import courseware.access as access @@ -31,6 +30,7 @@ from courseware.tests.helpers import LoginEnrollmentTestCase, masquerade_as_grou from lms.djangoapps.ccx.models import CustomCourseForEdX from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES +from openedx.core.lib.tests import attr from student.models import CourseEnrollment from student.roles import CourseCcxCoachRole, CourseStaffRole from student.tests.factories import ( diff --git a/lms/djangoapps/courseware/tests/test_course_info.py b/lms/djangoapps/courseware/tests/test_course_info.py index 156a4c8119..1d15f3b60f 100644 --- a/lms/djangoapps/courseware/tests/test_course_info.py +++ b/lms/djangoapps/courseware/tests/test_course_info.py @@ -11,10 +11,10 @@ from django.test.utils import override_settings from ccx_keys.locator import CCXLocator from lms.djangoapps.ccx.tests.factories import CcxFactory -from nose.plugins.attrib import attr from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration_context from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES, override_waffle_flag +from openedx.core.lib.tests import attr from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG from openedx.features.enterprise_support.tests.mixins.enterprise import EnterpriseTestConsentRequired from pyquery import PyQuery as pq diff --git a/lms/djangoapps/courseware/tests/test_course_survey.py b/lms/djangoapps/courseware/tests/test_course_survey.py index c51e8abb2a..995639033d 100644 --- a/lms/djangoapps/courseware/tests/test_course_survey.py +++ b/lms/djangoapps/courseware/tests/test_course_survey.py @@ -7,7 +7,6 @@ from copy import deepcopy from django.contrib.auth.models import User from django.urls import reverse -from nose.plugins.attrib import attr from common.test.utils import XssTestMixin from courseware.tests.helpers import LoginEnrollmentTestCase @@ -16,12 +15,11 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) class SurveyViewsTests(LoginEnrollmentTestCase, SharedModuleStoreTestCase, XssTestMixin): """ All tests for the views.py file """ - + shard = 1 STUDENT_INFO = [('view@test.com', 'foo')] @classmethod diff --git a/lms/djangoapps/courseware/tests/test_course_tools.py b/lms/djangoapps/courseware/tests/test_course_tools.py index 8060e1e4e4..57214813c0 100644 --- a/lms/djangoapps/courseware/tests/test_course_tools.py +++ b/lms/djangoapps/courseware/tests/test_course_tools.py @@ -6,7 +6,6 @@ import crum import datetime from mock import patch -from nose.plugins.attrib import attr import pytz from django.test import RequestFactory @@ -23,8 +22,8 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=3) class VerifiedUpgradeToolTest(SharedModuleStoreTestCase): + shard = 3 @classmethod def setUpClass(cls): diff --git a/lms/djangoapps/courseware/tests/test_courses.py b/lms/djangoapps/courseware/tests/test_courses.py index 92454ee202..8f15eb73d0 100644 --- a/lms/djangoapps/courseware/tests/test_courses.py +++ b/lms/djangoapps/courseware/tests/test_courses.py @@ -12,7 +12,6 @@ from django.conf import settings from django.urls import reverse from django.test.client import RequestFactory from django.test.utils import override_settings -from nose.plugins.attrib import attr from opaque_keys.edx.keys import CourseKey from six import text_type @@ -34,6 +33,7 @@ from courseware.module_render import get_module_for_descriptor from lms.djangoapps.courseware.courseware_access_exception import CoursewareAccessException from openedx.core.djangolib.testing.utils import get_mock_request from openedx.core.lib.courses import course_image_url +from openedx.core.lib.tests import attr from student.tests.factories import UserFactory from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import _get_modulestore_branch_setting, modulestore diff --git a/lms/djangoapps/courseware/tests/test_date_summary.py b/lms/djangoapps/courseware/tests/test_date_summary.py index b58195f864..30c13deb3f 100644 --- a/lms/djangoapps/courseware/tests/test_date_summary.py +++ b/lms/djangoapps/courseware/tests/test_date_summary.py @@ -9,7 +9,6 @@ from django.urls import reverse from django.test import RequestFactory from freezegun import freeze_time from mock import patch -from nose.plugins.attrib import attr from pytz import utc from course_modes.models import CourseMode @@ -37,6 +36,7 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from openedx.core.djangoapps.site_configuration.tests.factories import SiteFactory from openedx.core.djangoapps.user_api.preferences.api import set_user_preference from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag +from openedx.core.lib.tests import attr from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG, UPGRADE_DEADLINE_MESSAGE, CourseHomeMessages from student.tests.factories import TEST_PASSWORD, CourseEnrollmentFactory, UserFactory from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase diff --git a/lms/djangoapps/courseware/tests/test_draft_modulestore.py b/lms/djangoapps/courseware/tests/test_draft_modulestore.py index dac9675b73..9566f90829 100644 --- a/lms/djangoapps/courseware/tests/test_draft_modulestore.py +++ b/lms/djangoapps/courseware/tests/test_draft_modulestore.py @@ -1,15 +1,15 @@ from django.test import TestCase -from nose.plugins.attrib import attr from opaque_keys.edx.keys import CourseKey from xmodule.modulestore.django import modulestore -@attr(shard=1) class TestDraftModuleStore(TestCase): """ Test the draft modulestore """ + shard = 1 + def test_get_items_with_course_items(self): store = modulestore() diff --git a/lms/djangoapps/courseware/tests/test_entrance_exam.py b/lms/djangoapps/courseware/tests/test_entrance_exam.py index eeeab157a4..196623f5fb 100644 --- a/lms/djangoapps/courseware/tests/test_entrance_exam.py +++ b/lms/djangoapps/courseware/tests/test_entrance_exam.py @@ -17,7 +17,6 @@ from courseware.module_render import get_module, handle_xblock_callback, toc_for from courseware.tests.factories import InstructorFactory, StaffFactory, UserFactory from courseware.tests.helpers import LoginEnrollmentTestCase from milestones.tests.utils import MilestonesTestCaseMixin -from nose.plugins.attrib import attr from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag from openedx.core.djangolib.testing.utils import get_mock_request from openedx.features.course_experience import COURSE_OUTLINE_PAGE_FLAG, UNIFIED_COURSE_TAB_FLAG @@ -36,7 +35,6 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory -@attr(shard=2) @patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True}) class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase, MilestonesTestCaseMixin): """ @@ -45,6 +43,8 @@ class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase, Milest Creates a test course from scratch. The tests below are designed to execute workflows regardless of the feature flag settings. """ + shard = 2 + @patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True}) def setUp(self): """ diff --git a/lms/djangoapps/courseware/tests/test_favicon.py b/lms/djangoapps/courseware/tests/test_favicon.py index 5152bce4ef..9450f2fe70 100644 --- a/lms/djangoapps/courseware/tests/test_favicon.py +++ b/lms/djangoapps/courseware/tests/test_favicon.py @@ -1,15 +1,14 @@ from django.test import TestCase from django.test.utils import override_settings -from nose.plugins.attrib import attr from util.testing import UrlResetMixin -@attr(shard=1) class FaviconTestCase(UrlResetMixin, TestCase): """ Tests of the courseware favicon. """ + shard = 1 def test_favicon_redirect(self): resp = self.client.get("/favicon.ico") diff --git a/lms/djangoapps/courseware/tests/test_field_overrides.py b/lms/djangoapps/courseware/tests/test_field_overrides.py index 7cb98b9416..0478dd830c 100644 --- a/lms/djangoapps/courseware/tests/test_field_overrides.py +++ b/lms/djangoapps/courseware/tests/test_field_overrides.py @@ -5,9 +5,9 @@ Tests for `field_overrides` module. import unittest from django.test.utils import override_settings -from nose.plugins.attrib import attr from xblock.field_data import DictFieldData +from openedx.core.lib.tests import attr from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory diff --git a/lms/djangoapps/courseware/tests/test_footer.py b/lms/djangoapps/courseware/tests/test_footer.py index c655afe8e2..2b76db6d99 100644 --- a/lms/djangoapps/courseware/tests/test_footer.py +++ b/lms/djangoapps/courseware/tests/test_footer.py @@ -8,17 +8,16 @@ import unittest from django.conf import settings from django.test import TestCase from django.test.utils import override_settings -from nose.plugins.attrib import attr from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') -@attr(shard=1) class TestFooter(TestCase): """ Tests for edx and OpenEdX footer """ + shard = 1 SOCIAL_MEDIA_NAMES = [ "facebook", diff --git a/lms/djangoapps/courseware/tests/test_group_access.py b/lms/djangoapps/courseware/tests/test_group_access.py index bec7062f6a..581cbb6087 100644 --- a/lms/djangoapps/courseware/tests/test_group_access.py +++ b/lms/djangoapps/courseware/tests/test_group_access.py @@ -4,7 +4,6 @@ access control rules. """ import ddt -from nose.plugins.attrib import attr from stevedore.extension import Extension, ExtensionManager import courseware.access as access @@ -50,13 +49,14 @@ def resolve_attrs(test_method): return _wrapper -@attr(shard=7) @ddt.ddt class GroupAccessTestCase(ModuleStoreTestCase): """ Tests to ensure that has_access() correctly enforces the visibility restrictions specified in the `group_access` field of XBlocks. """ + shard = 7 + def set_user_group(self, user, partition, group): """ Internal DRY / shorthand. diff --git a/lms/djangoapps/courseware/tests/test_i18n.py b/lms/djangoapps/courseware/tests/test_i18n.py index 939cc69793..71fd9c4840 100644 --- a/lms/djangoapps/courseware/tests/test_i18n.py +++ b/lms/djangoapps/courseware/tests/test_i18n.py @@ -11,10 +11,10 @@ from django.urls import reverse, reverse_lazy from django.test import TestCase from django.test.client import Client from django.utils import translation -from nose.plugins.attrib import attr from openedx.core.djangoapps.dark_lang.models import DarkLangConfig from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY +from openedx.core.lib.tests import attr from student.tests.factories import UserFactory diff --git a/lms/djangoapps/courseware/tests/test_lti_integration.py b/lms/djangoapps/courseware/tests/test_lti_integration.py index 007489ec1b..a6a7e4ba37 100644 --- a/lms/djangoapps/courseware/tests/test_lti_integration.py +++ b/lms/djangoapps/courseware/tests/test_lti_integration.py @@ -5,14 +5,12 @@ import urllib from collections import OrderedDict import mock -import pytest from django.conf import settings from django.urls import reverse import oauthlib from courseware.tests.helpers import BaseTestXmodule from courseware.views.views import get_course_lti_endpoints -from nose.plugins.attrib import attr from openedx.core.lib.url_utils import quote_slashes from six import text_type from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase @@ -20,7 +18,6 @@ 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. @@ -30,6 +27,7 @@ class TestLTI(BaseTestXmodule): of `oauthlib` library. """ CATEGORY = "lti" + shard = 1 def setUp(self): """ @@ -126,7 +124,6 @@ class TestLTI(BaseTestXmodule): self.assertEqual(generated_content, expected_content) -@attr(shard=1) class TestLTIModuleListing(SharedModuleStoreTestCase): """ a test for the rest endpoint that lists LTI modules in a course @@ -134,6 +131,7 @@ class TestLTIModuleListing(SharedModuleStoreTestCase): # arbitrary constant COURSE_SLUG = "100" COURSE_NAME = "test_course" + shard = 1 @classmethod def setUpClass(cls): diff --git a/lms/djangoapps/courseware/tests/test_masquerade.py b/lms/djangoapps/courseware/tests/test_masquerade.py index 67c86a2648..bbff157327 100644 --- a/lms/djangoapps/courseware/tests/test_masquerade.py +++ b/lms/djangoapps/courseware/tests/test_masquerade.py @@ -18,11 +18,11 @@ from courseware.masquerade import CourseMasquerade, MasqueradingKeyValueStore, g from courseware.tests.factories import StaffFactory from courseware.tests.helpers import LoginEnrollmentTestCase, masquerade_as_group_member from courseware.tests.test_submitting_problems import ProblemSubmissionTestMixin -from nose.plugins.attrib import attr from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from openedx.core.djangoapps.user_api.preferences.api import get_user_preference, set_user_preference from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag +from openedx.core.lib.tests import attr from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG from student.models import CourseEnrollment from student.tests.factories import UserFactory diff --git a/lms/djangoapps/courseware/tests/test_microsites.py b/lms/djangoapps/courseware/tests/test_microsites.py index 7fb321144d..e474b62da2 100644 --- a/lms/djangoapps/courseware/tests/test_microsites.py +++ b/lms/djangoapps/courseware/tests/test_microsites.py @@ -2,14 +2,12 @@ Tests related to the Site Configuration feature """ -import pytest from bs4 import BeautifulSoup from contextlib import contextmanager from django.conf import settings from django.urls import reverse from django.test.utils import override_settings from mock import patch -from nose.plugins.attrib import attr from six import text_type from course_modes.models import CourseMode @@ -19,12 +17,11 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory -@attr(shard=1) class TestSites(SharedModuleStoreTestCase, LoginEnrollmentTestCase): """ This is testing of the Site Configuration feature """ - + shard = 1 STUDENT_INFO = [('view@test.com', 'foo'), ('view2@test.com', 'foo')] ENABLED_SIGNALS = ['course_published'] diff --git a/lms/djangoapps/courseware/tests/test_middleware.py b/lms/djangoapps/courseware/tests/test_middleware.py index addfeb9f3b..a83996bae9 100644 --- a/lms/djangoapps/courseware/tests/test_middleware.py +++ b/lms/djangoapps/courseware/tests/test_middleware.py @@ -4,7 +4,6 @@ Tests for courseware middleware from django.http import Http404 from django.test.client import RequestFactory -from nose.plugins.attrib import attr from lms.djangoapps.courseware.exceptions import Redirect from lms.djangoapps.courseware.middleware import RedirectMiddleware @@ -12,9 +11,9 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) class CoursewareMiddlewareTestCase(SharedModuleStoreTestCase): """Tests that courseware middleware is correctly redirected""" + shard = 1 @classmethod def setUpClass(cls): diff --git a/lms/djangoapps/courseware/tests/test_model_data.py b/lms/djangoapps/courseware/tests/test_model_data.py index 14320d95aa..d5a769c984 100644 --- a/lms/djangoapps/courseware/tests/test_model_data.py +++ b/lms/djangoapps/courseware/tests/test_model_data.py @@ -7,7 +7,6 @@ from functools import partial from django.db import DatabaseError from django.test import TestCase from mock import Mock, patch -from nose.plugins.attrib import attr from xblock.core import XBlock from xblock.exceptions import KeyValueMultiSaveError from xblock.fields import BlockScope, Scope, ScopeIds @@ -27,6 +26,7 @@ from courseware.tests.factories import ( course_id, location ) +from openedx.core.lib.tests import attr from student.tests.factories import UserFactory diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index ae2eab1c96..04b68f2fa4 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -8,7 +8,6 @@ from datetime import datetime from functools import partial import ddt -import pytest import pytz from bson import ObjectId from completion.models import BlockCompletion @@ -25,7 +24,6 @@ from edx_proctoring.tests.test_services import MockCreditService, MockGradesServ from freezegun import freeze_time from milestones.tests.utils import MilestonesTestCaseMixin from mock import MagicMock, Mock, patch -from nose.plugins.attrib import attr from opaque_keys.edx.keys import CourseKey, UsageKey from pyquery import PyQuery from six import text_type @@ -53,6 +51,7 @@ from openedx.core.djangoapps.credit.api import set_credit_requirement_status, se from openedx.core.djangoapps.credit.models import CreditCourse from openedx.core.lib.courses import course_image_url from openedx.core.lib.gating import api as gating_api +from openedx.core.lib.tests import attr from openedx.core.lib.url_utils import quote_slashes from student.models import anonymous_id_for_user from verify_student.tests.factories import SoftwareSecurePhotoVerificationFactory diff --git a/lms/djangoapps/courseware/tests/test_navigation.py b/lms/djangoapps/courseware/tests/test_navigation.py index e5f61a34c5..b6397abeb1 100644 --- a/lms/djangoapps/courseware/tests/test_navigation.py +++ b/lms/djangoapps/courseware/tests/test_navigation.py @@ -7,7 +7,6 @@ from django.conf import settings from django.urls import reverse from django.test.utils import override_settings from mock import patch -from nose.plugins.attrib import attr from six import text_type from courseware.tests.factories import GlobalStaffFactory @@ -20,12 +19,11 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory -@attr(shard=1) class TestNavigation(SharedModuleStoreTestCase, LoginEnrollmentTestCase): """ Check that navigation state is saved properly. """ - + shard = 1 STUDENT_INFO = [('view@test.com', 'foo'), ('view2@test.com', 'foo')] @classmethod diff --git a/lms/djangoapps/courseware/tests/test_password_history.py b/lms/djangoapps/courseware/tests/test_password_history.py index 05d6ad72ff..89b7f6640d 100644 --- a/lms/djangoapps/courseware/tests/test_password_history.py +++ b/lms/djangoapps/courseware/tests/test_password_history.py @@ -14,19 +14,18 @@ from django.utils import timezone from django.utils.http import int_to_base36 from freezegun import freeze_time from mock import patch -from nose.plugins.attrib import attr from courseware.tests.helpers import LoginEnrollmentTestCase from student.models import PasswordHistory -@attr(shard=1) @patch.dict("django.conf.settings.FEATURES", {'ADVANCED_SECURITY': True}) @ddt.ddt class TestPasswordHistory(LoginEnrollmentTestCase): """ Go through some of the PasswordHistory use cases """ + shard = 1 def _login(self, email, password, should_succeed=True, err_msg_check=None): """ diff --git a/lms/djangoapps/courseware/tests/test_split_module.py b/lms/djangoapps/courseware/tests/test_split_module.py index 41b1fd9142..4d72046af7 100644 --- a/lms/djangoapps/courseware/tests/test_split_module.py +++ b/lms/djangoapps/courseware/tests/test_split_module.py @@ -3,7 +3,6 @@ Test for split test XModule """ from django.urls import reverse from mock import MagicMock -from nose.plugins.attrib import attr from six import text_type from courseware.model_data import FieldDataCache @@ -15,7 +14,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.partitions.partitions import Group, UserPartition -@attr(shard=1) class SplitTestBase(SharedModuleStoreTestCase): """ Sets up a basic course and user for split test testing. @@ -26,6 +24,7 @@ class SplitTestBase(SharedModuleStoreTestCase): ICON_CLASSES = None TOOLTIPS = None VISIBLE_CONTENT = None + shard = 1 @classmethod def setUpClass(cls): @@ -285,11 +284,12 @@ class TestVertSplitTestVert(SplitTestBase): ] -@attr(shard=1) class SplitTestPosition(SharedModuleStoreTestCase): """ Check that we can change positions in a course with partitions defined """ + shard = 1 + @classmethod def setUpClass(cls): super(SplitTestPosition, cls).setUpClass() diff --git a/lms/djangoapps/courseware/tests/test_submitting_problems.py b/lms/djangoapps/courseware/tests/test_submitting_problems.py index 5505520ad1..0b0eb1b544 100644 --- a/lms/djangoapps/courseware/tests/test_submitting_problems.py +++ b/lms/djangoapps/courseware/tests/test_submitting_problems.py @@ -17,7 +17,6 @@ from django.test import TestCase from django.test.client import RequestFactory from django.utils.timezone import now from mock import patch -from nose.plugins.attrib import attr from six import text_type from capa.tests.response_xml_factory import ( @@ -34,6 +33,7 @@ from lms.djangoapps.grades.tasks import compute_all_grades_for_course from openedx.core.djangoapps.credit.api import get_credit_requirement_status, set_credit_requirements from openedx.core.djangoapps.credit.models import CreditCourse, CreditProvider from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory +from openedx.core.lib.tests import attr from openedx.core.lib.url_utils import quote_slashes from student.models import CourseEnrollment, anonymous_id_for_user from submissions import api as submissions_api diff --git a/lms/djangoapps/courseware/tests/test_tabs.py b/lms/djangoapps/courseware/tests/test_tabs.py index e261c252c8..95f47751c1 100644 --- a/lms/djangoapps/courseware/tests/test_tabs.py +++ b/lms/djangoapps/courseware/tests/test_tabs.py @@ -2,13 +2,11 @@ Test cases for tabs. """ -import pytest from django.contrib.auth.models import AnonymousUser from django.urls import reverse from django.http import Http404 from milestones.tests.utils import MilestonesTestCaseMixin from mock import MagicMock, Mock, patch -from nose.plugins.attrib import attr from six import text_type from courseware.courses import get_course_by_id @@ -25,6 +23,7 @@ from courseware.tests.helpers import LoginEnrollmentTestCase from courseware.views.views import StaticCourseTabView, get_static_tab_fragment from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag from openedx.core.djangolib.testing.utils import get_mock_request +from openedx.core.lib.tests import attr from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG from student.models import CourseEnrollment from student.tests.factories import UserFactory diff --git a/lms/djangoapps/courseware/tests/test_video_handlers.py b/lms/djangoapps/courseware/tests/test_video_handlers.py index d0b1e7a461..d4a783f730 100644 --- a/lms/djangoapps/courseware/tests/test_video_handlers.py +++ b/lms/djangoapps/courseware/tests/test_video_handlers.py @@ -12,11 +12,11 @@ import freezegun from django.core.files.base import ContentFile from django.utils.timezone import now from mock import MagicMock, Mock, patch -from nose.plugins.attrib import attr from webob import Request, Response from common.test.utils import normalize_repr from openedx.core.djangoapps.contentserver.caching import del_cached_content +from openedx.core.lib.tests import attr from xmodule.contentstore.content import StaticContent from xmodule.contentstore.django import contentstore from xmodule.exceptions import NotFoundError diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index 37eb51e758..0fd5f90968 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -31,9 +31,9 @@ from edxval.api import ( from edxval.utils import create_file_in_fs from lxml import etree from mock import MagicMock, Mock, patch -from nose.plugins.attrib import attr from path import Path as path +from openedx.core.lib.tests import attr from xmodule.contentstore.content import StaticContent from xmodule.exceptions import NotFoundError from xmodule.modulestore import ModuleStoreEnum diff --git a/lms/djangoapps/courseware/tests/test_video_xml.py b/lms/djangoapps/courseware/tests/test_video_xml.py index 6c789f8672..b3fb6d9f4d 100644 --- a/lms/djangoapps/courseware/tests/test_video_xml.py +++ b/lms/djangoapps/courseware/tests/test_video_xml.py @@ -14,8 +14,6 @@ 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.tests import LogicTest from xmodule.video_module import VideoDescriptor @@ -35,7 +33,6 @@ SOURCE_XML = """ """ -@attr(shard=1) class VideoModuleLogicTest(LogicTest): """Tests for logic of Video Xmodule.""" @@ -44,6 +41,7 @@ class VideoModuleLogicTest(LogicTest): raw_field_data = { 'data': '