diff --git a/cms/djangoapps/contentstore/tests/test_transcripts_utils.py b/cms/djangoapps/contentstore/tests/test_transcripts_utils.py index 2a004433f8..84395590af 100644 --- a/cms/djangoapps/contentstore/tests/test_transcripts_utils.py +++ b/cms/djangoapps/contentstore/tests/test_transcripts_utils.py @@ -8,11 +8,11 @@ import textwrap import unittest from uuid import uuid4 +import pytest from django.conf import settings from django.test.utils import override_settings from django.utils import translation from mock import Mock, patch -from nose.plugins.skip import SkipTest from six import text_type from contentstore.tests.utils import mock_requests_get @@ -267,9 +267,9 @@ class TestDownloadYoutubeSubs(TestYoutubeSubsBase): def test_success_downloading_chinese_transcripts(self): # Disabled 11/14/13 - # This test is flakey because it performs an HTTP request on an external service + # This test is flaky because it performs an HTTP request on an external service # Re-enable when `requests.get` is patched using `mock.patch` - raise SkipTest + pytest.skip() good_youtube_sub = 'j_jEn79vS3g' # Chinese, utf-8 self.clear_sub_content(good_youtube_sub) diff --git a/lms/djangoapps/badges/api/tests.py b/lms/djangoapps/badges/api/tests.py index 2078b50bec..e242203f7d 100644 --- a/lms/djangoapps/badges/api/tests.py +++ b/lms/djangoapps/badges/api/tests.py @@ -4,7 +4,6 @@ Tests for the badges API views. from ddt import data, ddt, unpack from django.conf import settings from django.test.utils import override_settings -from nose.plugins.attrib import attr from badges.tests.factories import BadgeAssertionFactory, BadgeClassFactory, RandomBadgeClassFactory from openedx.core.lib.api.test_utils import ApiTestCase @@ -152,12 +151,12 @@ class TestUserCourseBadgeAssertions(UserAssertionTestCase): self.check_assertion_structure(assertion, response['results'][0]) -@attr(shard=3) @ddt class TestUserBadgeAssertionsByClass(UserAssertionTestCase): """ Test the Badge Assertions view with the badge class filter. """ + shard = 3 @unpack @data((False, False), (True, False), (True, True)) diff --git a/lms/djangoapps/badges/tests/test_models.py b/lms/djangoapps/badges/tests/test_models.py index 78242024cf..4fc3217eb8 100644 --- a/lms/djangoapps/badges/tests/test_models.py +++ b/lms/djangoapps/badges/tests/test_models.py @@ -1,7 +1,6 @@ """ Tests for the Badges app models. """ -import pytest from path import Path from django.core.exceptions import ValidationError from django.core.files.images import ImageFile @@ -10,7 +9,6 @@ from django.db.utils import IntegrityError from django.test import TestCase from django.test.utils import override_settings from mock import Mock, patch -from nose.plugins.attrib import attr from badges.models import ( BadgeAssertion, @@ -33,12 +31,13 @@ def get_image(name): return ImageFile(open(TEST_DATA_ROOT / 'badges' / name + '.png')) -@attr(shard=1) @override_settings(MEDIA_ROOT=TEST_DATA_ROOT) class BadgeImageConfigurationTest(TestCase): """ Test the validation features of BadgeImageConfiguration. """ + shard = 1 + def tearDown(self): tmp_path = Path(TEST_DATA_ROOT / 'course_complete_badges') Path.rmtree_p(tmp_path) diff --git a/lms/djangoapps/branding/tests/test_models.py b/lms/djangoapps/branding/tests/test_models.py index 1a00ab5241..f9393a1c86 100644 --- a/lms/djangoapps/branding/tests/test_models.py +++ b/lms/djangoapps/branding/tests/test_models.py @@ -3,16 +3,16 @@ Tests for the Video Branding configuration. """ from django.core.exceptions import ValidationError from django.test import TestCase -from nose.plugins.attrib import attr from branding.models import BrandingInfoConfig -@attr(shard=1) class BrandingInfoConfigTest(TestCase): """ Test the BrandingInfoConfig model. """ + shard = 1 + def setUp(self): super(BrandingInfoConfigTest, self).setUp() self.configuration_string = """{ diff --git a/lms/djangoapps/branding/tests/test_page.py b/lms/djangoapps/branding/tests/test_page.py index 867170c8ca..b3ea5a604a 100644 --- a/lms/djangoapps/branding/tests/test_page.py +++ b/lms/djangoapps/branding/tests/test_page.py @@ -11,13 +11,13 @@ from django.test.client import RequestFactory from django.test.utils import override_settings from milestones.tests.utils import MilestonesTestCaseMixin from mock import Mock, patch -from nose.plugins.attrib import attr from pytz import UTC from branding.views import index from courseware.tests.helpers import LoginEnrollmentTestCase from edxmako.shortcuts import render_to_response from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin +from openedx.core.lib.tests import attr from util.milestones_helpers import set_prerequisite_courses from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory diff --git a/lms/djangoapps/bulk_email/tests/test_course_optout.py b/lms/djangoapps/bulk_email/tests/test_course_optout.py index 61a18f146b..f211ec44c3 100644 --- a/lms/djangoapps/bulk_email/tests/test_course_optout.py +++ b/lms/djangoapps/bulk_email/tests/test_course_optout.py @@ -8,7 +8,6 @@ from django.core import mail from django.core.management import call_command from django.urls import reverse from mock import Mock, patch -from nose.plugins.attrib import attr from six import text_type from bulk_email.models import BulkEmailFlag @@ -23,12 +22,12 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) class TestOptoutCourseEmails(ModuleStoreTestCase): """ Test that optouts are referenced in sending course email. """ + shard = 1 def setUp(self): super(TestOptoutCourseEmails, self).setUp() @@ -118,12 +117,13 @@ class TestOptoutCourseEmails(ModuleStoreTestCase): self.assertIn(self.instructor.email, sent_addresses) -@attr(shard=1) @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) class TestACEOptoutCourseEmails(ModuleStoreTestCase): """ Test that optouts are referenced in sending course email. """ + shard = 1 + def setUp(self): super(TestACEOptoutCourseEmails, self).setUp() course_title = u"ẗëṡẗ title イ乇丂イ ᄊ乇丂丂ムg乇 キo尺 ムレレ тэѕт мэѕѕаБэ" diff --git a/lms/djangoapps/bulk_email/tests/test_email.py b/lms/djangoapps/bulk_email/tests/test_email.py index 9476039af9..98bdd98bf0 100644 --- a/lms/djangoapps/bulk_email/tests/test_email.py +++ b/lms/djangoapps/bulk_email/tests/test_email.py @@ -16,7 +16,6 @@ from django.test.utils import override_settings from django.utils.translation import get_language from markupsafe import escape from mock import Mock, patch -from nose.plugins.attrib import attr from bulk_email.models import BulkEmailFlag, Optout from bulk_email.tasks import _get_course_email_context, _get_source_address @@ -26,6 +25,7 @@ from enrollment.api import update_enrollment from lms.djangoapps.instructor_task.subtasks import update_subtask_status from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort from openedx.core.djangoapps.course_groups.models import CourseCohort +from openedx.core.lib.tests import attr from student.models import CourseEnrollment from student.roles import CourseStaffRole from student.tests.factories import CourseEnrollmentFactory, UserFactory diff --git a/lms/djangoapps/bulk_email/tests/test_err_handling.py b/lms/djangoapps/bulk_email/tests/test_err_handling.py index 14186b8af6..4529b9d54c 100644 --- a/lms/djangoapps/bulk_email/tests/test_err_handling.py +++ b/lms/djangoapps/bulk_email/tests/test_err_handling.py @@ -13,7 +13,6 @@ from django.core.management import call_command from django.urls import reverse from django.db import DatabaseError from mock import Mock, patch -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from six import text_type @@ -39,12 +38,12 @@ class EmailTestException(Exception): @ddt.ddt -@attr(shard=1) @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) class TestEmailErrors(ModuleStoreTestCase): """ Test that errors from sending email are handled properly. """ + shard = 1 ENABLED_CACHES = ['default', 'mongo_metadata_inheritance', 'loc_cache'] diff --git a/lms/djangoapps/bulk_email/tests/test_forms.py b/lms/djangoapps/bulk_email/tests/test_forms.py index 91948023d4..a616770444 100644 --- a/lms/djangoapps/bulk_email/tests/test_forms.py +++ b/lms/djangoapps/bulk_email/tests/test_forms.py @@ -3,7 +3,6 @@ Unit tests for bulk-email-related forms. """ -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from six import text_type @@ -13,9 +12,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) class CourseAuthorizationFormTest(ModuleStoreTestCase): """Test the CourseAuthorizationAdminForm form for Mongo-backed courses.""" + shard = 1 def setUp(self): super(CourseAuthorizationFormTest, self).setUp() diff --git a/lms/djangoapps/bulk_email/tests/test_models.py b/lms/djangoapps/bulk_email/tests/test_models.py index 40074241dc..d11e4a57f5 100644 --- a/lms/djangoapps/bulk_email/tests/test_models.py +++ b/lms/djangoapps/bulk_email/tests/test_models.py @@ -7,7 +7,6 @@ import ddt from django.core.management import call_command from django.test import TestCase from mock import Mock, patch -from nose.plugins.attrib import attr from opaque_keys.edx.keys import CourseKey from pytz import UTC @@ -22,6 +21,7 @@ from bulk_email.models import ( ) from course_modes.models import CourseMode from openedx.core.djangoapps.course_groups.models import CourseCohort +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/bulk_email/tests/test_signals.py b/lms/djangoapps/bulk_email/tests/test_signals.py index 18969de2e6..2c2b7f90d7 100644 --- a/lms/djangoapps/bulk_email/tests/test_signals.py +++ b/lms/djangoapps/bulk_email/tests/test_signals.py @@ -7,7 +7,6 @@ from django.core import mail from django.core.management import call_command from django.urls import reverse from mock import Mock, patch -from nose.plugins.attrib import attr from six import text_type from bulk_email.models import BulkEmailFlag, Optout @@ -17,12 +16,13 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) class TestOptoutCourseEmailsBySignal(ModuleStoreTestCase): """ Tests that the force_optout_all signal receiver opts the user out of course emails """ + shard = 1 + def setUp(self): super(TestOptoutCourseEmailsBySignal, self).setUp() self.course = CourseFactory.create(run='testcourse1', display_name="Test Course Title") diff --git a/lms/djangoapps/bulk_email/tests/test_tasks.py b/lms/djangoapps/bulk_email/tests/test_tasks.py index af57a6df75..ca6eb61adf 100644 --- a/lms/djangoapps/bulk_email/tests/test_tasks.py +++ b/lms/djangoapps/bulk_email/tests/test_tasks.py @@ -27,7 +27,6 @@ from celery.states import FAILURE, SUCCESS # pylint: disable=no-name-in-module, from django.conf import settings from django.core.management import call_command from mock import Mock, patch -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from bulk_email.models import SEND_TO_LEARNERS, SEND_TO_MYSELF, SEND_TO_STAFF, CourseEmail, Optout @@ -73,10 +72,10 @@ def my_update_subtask_status(entry_id, current_task_id, new_subtask_status): update_subtask_status(entry_id, current_task_id, new_subtask_status) -@attr(shard=5) @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase): """Tests instructor task that send bulk email.""" + shard = 5 def setUp(self): super(TestBulkEmailInstructorTask, self).setUp() diff --git a/lms/djangoapps/ccx/api/v0/tests/test_views.py b/lms/djangoapps/ccx/api/v0/tests/test_views.py index d89c01780d..f6ea536a98 100644 --- a/lms/djangoapps/ccx/api/v0/tests/test_views.py +++ b/lms/djangoapps/ccx/api/v0/tests/test_views.py @@ -16,7 +16,6 @@ from django.conf import settings from django.contrib.auth.models import User from django.urls import Resolver404, resolve, reverse from django.utils.timezone import now -from nose.plugins.attrib import attr from oauth2_provider import models as dot_models from opaque_keys.edx.keys import CourseKey from provider.constants import CONFIDENTIAL @@ -161,13 +160,13 @@ class CcxRestApiTest(CcxTestCase, APITestCase): self.assertEqual(expected_field_errors, resp_dict_error) -@attr(shard=9) @ddt.ddt class CcxListTest(CcxRestApiTest): """ Test for the CCX REST APIs """ ENABLED_SIGNALS = ['course_published'] + shard = 9 @classmethod def setUpClass(cls): @@ -872,13 +871,13 @@ class CcxListTest(CcxRestApiTest): self.assertEqual(course_user, ccx_user) -@attr(shard=9) @ddt.ddt class CcxDetailTest(CcxRestApiTest): """ Test for the CCX REST APIs """ ENABLED_SIGNALS = ['course_published'] + shard = 9 def setUp(self): """ diff --git a/lms/djangoapps/ccx/tests/test_field_override_performance.py b/lms/djangoapps/ccx/tests/test_field_override_performance.py index e9410a318d..c76dfebfce 100644 --- a/lms/djangoapps/ccx/tests/test_field_override_performance.py +++ b/lms/djangoapps/ccx/tests/test_field_override_performance.py @@ -7,6 +7,7 @@ from datetime import datetime import ddt import mock +import pytest from ccx_keys.locator import CCXLocator from courseware.field_overrides import OverrideFieldData from courseware.testutils import FieldOverrideTestMixin @@ -16,8 +17,6 @@ from django.core.cache import caches from django.test.client import RequestFactory from django.test.utils import override_settings from lms.djangoapps.ccx.tests.factories import CcxFactory -from nose.plugins.attrib import attr -from nose.plugins.skip import SkipTest from opaque_keys.edx.keys import CourseKey from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES @@ -37,7 +36,6 @@ from xmodule.modulestore.tests.utils import ProceduralCourseTestMixin QUERY_COUNT_TABLE_BLACKLIST = WAFFLE_TABLES -@attr(shard=7) @mock.patch.dict( 'django.conf.settings.FEATURES', { @@ -53,6 +51,7 @@ class FieldOverridePerformanceTestCase(FieldOverrideTestMixin, ProceduralCourseT __test__ = False # Tell Django to clean out all databases, not just default multi_db = True + shard = 7 # TEST_DATA must be overridden by subclasses TEST_DATA = None @@ -204,13 +203,13 @@ class FieldOverridePerformanceTestCase(FieldOverrideTestMixin, ProceduralCourseT 'ccx': ('ccx.overrides.CustomCoursesForEdxOverrideProvider',) } if overrides == 'no_overrides' and view_as_ccx: - raise SkipTest("Can't view a ccx course if field overrides are disabled.") + pytest.skip("Can't view a ccx course if field overrides are disabled.") if not enable_ccx and view_as_ccx: - raise SkipTest("Can't view a ccx course if ccx is disabled on the course") + pytest.skip("Can't view a ccx course if ccx is disabled on the course") if self.MODULESTORE == TEST_DATA_MONGO_MODULESTORE and view_as_ccx: - raise SkipTest("Can't use a MongoModulestore test as a CCX course") + pytest.skip("Can't use a MongoModulestore test as a CCX course") with self.settings( XBLOCK_FIELD_DATA_WRAPPERS=['lms.djangoapps.courseware.field_overrides:OverrideModulestoreFieldData.wrap'], diff --git a/lms/djangoapps/ccx/tests/test_models.py b/lms/djangoapps/ccx/tests/test_models.py index c45e0481cd..b688b0a5b7 100644 --- a/lms/djangoapps/ccx/tests/test_models.py +++ b/lms/djangoapps/ccx/tests/test_models.py @@ -5,7 +5,6 @@ import json from datetime import datetime, timedelta import ddt -from nose.plugins.attrib import attr from pytz import utc from student.roles import CourseCcxCoachRole @@ -18,12 +17,12 @@ from .factories import CcxFactory @ddt.ddt -@attr(shard=7) class TestCCX(ModuleStoreTestCase): """Unit tests for the CustomCourseForEdX model """ MODULESTORE = TEST_DATA_SPLIT_MODULESTORE + shard = 7 def setUp(self): """common setup for all tests""" diff --git a/lms/djangoapps/ccx/tests/test_overrides.py b/lms/djangoapps/ccx/tests/test_overrides.py index 464da0e976..536f26fc97 100644 --- a/lms/djangoapps/ccx/tests/test_overrides.py +++ b/lms/djangoapps/ccx/tests/test_overrides.py @@ -8,7 +8,6 @@ import mock import pytz from ccx_keys.locator import CCXLocator from django.test.utils import override_settings -from nose.plugins.attrib import attr from courseware.courses import get_course_by_id from courseware.field_overrides import OverrideFieldData @@ -23,7 +22,6 @@ from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory -@attr(shard=7) @override_settings( XBLOCK_FIELD_DATA_WRAPPERS=['lms.djangoapps.courseware.field_overrides:OverrideModulestoreFieldData.wrap'], MODULESTORE_FIELD_OVERRIDE_PROVIDERS=['ccx.overrides.CustomCoursesForEdxOverrideProvider'], @@ -33,6 +31,7 @@ class TestFieldOverrides(FieldOverrideTestMixin, SharedModuleStoreTestCase): Make sure field overrides behave in the expected manner. """ MODULESTORE = TEST_DATA_SPLIT_MODULESTORE + shard = 7 @classmethod def setUpClass(cls): diff --git a/lms/djangoapps/ccx/tests/test_utils.py b/lms/djangoapps/ccx/tests/test_utils.py index 3c95160677..9f6108e4e8 100644 --- a/lms/djangoapps/ccx/tests/test_utils.py +++ b/lms/djangoapps/ccx/tests/test_utils.py @@ -6,10 +6,7 @@ from smtplib import SMTPException import mock from ccx_keys.locator import CCXLocator -from nose.plugins.attrib import attr -from opaque_keys.edx.keys import CourseKey -from lms.djangoapps.ccx import utils from lms.djangoapps.ccx.tests.factories import CcxFactory from lms.djangoapps.ccx.tests.utils import CcxTestCase from lms.djangoapps.ccx.utils import add_master_course_staff_to_ccx, ccx_course, remove_master_course_staff_from_ccx @@ -22,10 +19,10 @@ from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=7) class TestGetCCXFromCCXLocator(ModuleStoreTestCase): """Verify that get_ccx_from_ccx_locator functions properly""" MODULESTORE = TEST_DATA_SPLIT_MODULESTORE + shard = 7 def setUp(self): """Set up a course, coach, ccx and user""" diff --git a/lms/djangoapps/ccx/tests/test_views.py b/lms/djangoapps/ccx/tests/test_views.py index a9e607ae8e..54e2a63654 100644 --- a/lms/djangoapps/ccx/tests/test_views.py +++ b/lms/djangoapps/ccx/tests/test_views.py @@ -15,7 +15,6 @@ from django.test.utils import override_settings from pytz import UTC from django.utils.translation import ugettext as _ from mock import MagicMock, patch -from nose.plugins.attrib import attr from opaque_keys.edx.keys import CourseKey from capa.tests.response_xml_factory import StringResponseXMLFactory @@ -38,6 +37,7 @@ from lms.djangoapps.grades.tasks import compute_all_grades_for_course from lms.djangoapps.instructor.access import allow_access, list_with_level from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.djangoapps.request_cache.middleware import RequestCache +from openedx.core.lib.tests import attr from student.models import CourseEnrollment, CourseEnrollmentAllowed from student.roles import CourseCcxCoachRole, CourseInstructorRole, CourseStaffRole from student.tests.factories import AdminFactory, CourseEnrollmentFactory, UserFactory diff --git a/lms/djangoapps/certificates/tests/test_api.py b/lms/djangoapps/certificates/tests/test_api.py index 3033162d63..df83bb041c 100644 --- a/lms/djangoapps/certificates/tests/test_api.py +++ b/lms/djangoapps/certificates/tests/test_api.py @@ -14,7 +14,6 @@ from django.test.utils import override_settings from django.utils import timezone from freezegun import freeze_time from mock import patch -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator import pytz @@ -33,6 +32,7 @@ from course_modes.tests.factories import CourseModeFactory from courseware.tests.factories import GlobalStaffFactory from lms.djangoapps.grades.tests.utils import mock_passing_grade from microsite_configuration import microsite +from openedx.core.lib.tests import attr from student.models import CourseEnrollment from student.tests.factories import UserFactory from util.testing import EventTestMixin diff --git a/lms/djangoapps/certificates/tests/test_cert_management.py b/lms/djangoapps/certificates/tests/test_cert_management.py index e6e2287645..0c3689b20d 100644 --- a/lms/djangoapps/certificates/tests/test_cert_management.py +++ b/lms/djangoapps/certificates/tests/test_cert_management.py @@ -1,11 +1,9 @@ """Tests for the resubmit_error_certificates management command. """ import ddt -import pytest from django.core.management import call_command from django.core.management.base import CommandError from django.test.utils import override_settings from mock import patch -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from six import text_type @@ -15,6 +13,7 @@ from badges.tests.factories import BadgeAssertionFactory, CourseCompleteImageCon from lms.djangoapps.certificates.models import CertificateStatuses, GeneratedCertificate from course_modes.models import CourseMode from lms.djangoapps.grades.tests.utils import mock_passing_grade +from openedx.core.lib.tests import attr from student.tests.factories import CourseEnrollmentFactory, UserFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls diff --git a/lms/djangoapps/certificates/tests/test_create_fake_cert.py b/lms/djangoapps/certificates/tests/test_create_fake_cert.py index cdf5f5a7ee..aa67adffc0 100644 --- a/lms/djangoapps/certificates/tests/test_create_fake_cert.py +++ b/lms/djangoapps/certificates/tests/test_create_fake_cert.py @@ -3,7 +3,6 @@ from django.core.management import call_command from django.core.management.base import CommandError from django.test import TestCase -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from six import text_type @@ -11,10 +10,9 @@ from lms.djangoapps.certificates.models import GeneratedCertificate from student.tests.factories import UserFactory -@attr(shard=1) class CreateFakeCertTest(TestCase): """Tests for the create_fake_certs management command. """ - + shard = 1 USERNAME = "test" COURSE_KEY = CourseLocator(org='edX', course='DemoX', run='Demo_Course') diff --git a/lms/djangoapps/certificates/tests/test_models.py b/lms/djangoapps/certificates/tests/test_models.py index 5d4f719e48..3c894ccad1 100644 --- a/lms/djangoapps/certificates/tests/test_models.py +++ b/lms/djangoapps/certificates/tests/test_models.py @@ -7,7 +7,6 @@ from django.core.exceptions import ValidationError from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase from django.test.utils import override_settings -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from path import Path as path @@ -23,6 +22,7 @@ from lms.djangoapps.certificates.models import ( ) from lms.djangoapps.certificates.tests.factories import CertificateInvalidationFactory, GeneratedCertificateFactory from lms.djangoapps.instructor_task.tests.factories import InstructorTaskFactory +from openedx.core.lib.tests import attr from student.tests.factories import AdminFactory, UserFactory from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory diff --git a/lms/djangoapps/certificates/tests/test_queue.py b/lms/djangoapps/certificates/tests/test_queue.py index 4c33ac2abf..f8312c11e9 100644 --- a/lms/djangoapps/certificates/tests/test_queue.py +++ b/lms/djangoapps/certificates/tests/test_queue.py @@ -10,7 +10,6 @@ import pytz from django.test import TestCase from django.test.utils import override_settings from mock import Mock, patch -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator # It is really unfortunate that we are using the XQueue client @@ -31,10 +30,10 @@ from xmodule.modulestore.tests.factories import CourseFactory @ddt.ddt -@attr(shard=1) @override_settings(CERT_QUEUE='certificates') class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase): """Test the "add to queue" operation of the XQueue interface. """ + shard = 1 def setUp(self): super(XQueueCertInterfaceAddCertificateTest, self).setUp() @@ -279,10 +278,10 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase): ) -@attr(shard=1) @override_settings(CERT_QUEUE='certificates') class XQueueCertInterfaceExampleCertificateTest(TestCase): """Tests for the XQueue interface for certificate generation. """ + shard = 1 COURSE_KEY = CourseLocator(org='test', course='test', run='test') diff --git a/lms/djangoapps/certificates/tests/test_views.py b/lms/djangoapps/certificates/tests/test_views.py index 7762988e43..7f777cf08e 100644 --- a/lms/djangoapps/certificates/tests/test_views.py +++ b/lms/djangoapps/certificates/tests/test_views.py @@ -10,7 +10,6 @@ from django.core.cache import cache from django.urls import reverse from django.test.client import Client from django.test.utils import override_settings -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from lms.djangoapps.certificates.api import get_certificate_url @@ -37,10 +36,10 @@ FEATURES_WITH_CUSTOM_CERTS_ENABLED = { FEATURES_WITH_CUSTOM_CERTS_ENABLED.update(FEATURES_WITH_CERTS_ENABLED) -@attr(shard=1) @ddt.ddt class UpdateExampleCertificateViewTest(CacheIsolationTestCase): """Tests for the XQueue callback that updates example certificates. """ + shard = 1 COURSE_KEY = CourseLocator(org='test', course='test', run='test') @@ -181,11 +180,12 @@ class UpdateExampleCertificateViewTest(CacheIsolationTestCase): self.assertEqual(content['return_code'], 0) -@attr(shard=1) class MicrositeCertificatesViewsTests(ModuleStoreTestCase): """ Tests for the microsite certificates web/html views """ + shard = 1 + def setUp(self): super(MicrositeCertificatesViewsTests, self).setUp() self.client = Client() diff --git a/lms/djangoapps/certificates/tests/test_webview_views.py b/lms/djangoapps/certificates/tests/test_webview_views.py index c3a37d4f22..00ccca9aff 100644 --- a/lms/djangoapps/certificates/tests/test_webview_views.py +++ b/lms/djangoapps/certificates/tests/test_webview_views.py @@ -11,7 +11,6 @@ from django.conf import settings from django.urls import reverse from django.test.client import Client, RequestFactory from django.test.utils import override_settings -from django.utils import translation from mock import patch import ddt @@ -38,7 +37,6 @@ from lms.djangoapps.badges.tests.factories import ( CourseCompleteImageConfigurationFactory ) from lms.djangoapps.grades.tests.utils import mock_passing_grade -from nose.plugins.attrib import attr from openedx.core.djangoapps.certificates.config import waffle from openedx.core.djangoapps.dark_lang.models import DarkLangConfig from openedx.core.lib.tests.assertions.events import assert_event_matches @@ -242,12 +240,12 @@ class CommonCertificatesTestCase(ModuleStoreTestCase): template.save() -@attr(shard=1) @ddt.ddt class CertificatesViewsTests(CommonCertificatesTestCase): """ Tests for the certificates web/html views """ + shard = 1 def setUp(self): super(CertificatesViewsTests, self).setUp() @@ -1711,11 +1709,12 @@ class CertificatesViewsTests(CommonCertificatesTestCase): ) -@attr(shard=1) class CertificateEventTests(CommonCertificatesTestCase, EventTrackingTestCase): """ Test events emitted by certificate handling. """ + shard = 1 + @override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED) def test_certificate_evidence_event_emitted(self): self.client.logout() diff --git a/lms/djangoapps/certificates/tests/tests.py b/lms/djangoapps/certificates/tests/tests.py index ca2bbf4f36..fec34b4124 100644 --- a/lms/djangoapps/certificates/tests/tests.py +++ b/lms/djangoapps/certificates/tests/tests.py @@ -7,7 +7,6 @@ from pytz import UTC from django.conf import settings from milestones.tests.utils import MilestonesTestCaseMixin from mock import patch -from nose.plugins.attrib import attr from badges.tests.factories import CourseCompleteImageConfigurationFactory from lms.djangoapps.certificates.models import ( @@ -24,12 +23,12 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) @ddt class CertificatesModelTest(ModuleStoreTestCase, MilestonesTestCaseMixin): """ Tests for the GeneratedCertificate model """ + shard = 1 def setUp(self): super(CertificatesModelTest, self).setUp() diff --git a/lms/djangoapps/class_dashboard/tests/test_dashboard_data.py b/lms/djangoapps/class_dashboard/tests/test_dashboard_data.py index 2b0dad8b17..aeb672b374 100644 --- a/lms/djangoapps/class_dashboard/tests/test_dashboard_data.py +++ b/lms/djangoapps/class_dashboard/tests/test_dashboard_data.py @@ -7,7 +7,6 @@ import json from django.urls import reverse from django.test.client import RequestFactory from mock import patch -from nose.plugins.attrib import attr from six import text_type from capa.tests.response_xml_factory import StringResponseXMLFactory @@ -32,11 +31,12 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory USER_COUNT = 11 -@attr(shard=6) class TestGetProblemGradeDistribution(SharedModuleStoreTestCase): """ Tests related to class_dashboard/dashboard_data.py """ + shard = 6 + @classmethod def setUpClass(cls): super(TestGetProblemGradeDistribution, cls).setUpClass() diff --git a/lms/djangoapps/class_dashboard/tests/test_views.py b/lms/djangoapps/class_dashboard/tests/test_views.py index bcc0cbde9a..d662b730c0 100644 --- a/lms/djangoapps/class_dashboard/tests/test_views.py +++ b/lms/djangoapps/class_dashboard/tests/test_views.py @@ -5,7 +5,6 @@ import json from django.test.client import RequestFactory from mock import patch -from nose.plugins.attrib import attr from six import text_type from class_dashboard import views @@ -14,11 +13,11 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=1) class TestViews(ModuleStoreTestCase): """ Tests related to class_dashboard/views.py """ + shard = 1 def setUp(self): super(TestViews, self).setUp() diff --git a/lms/djangoapps/commerce/api/v0/tests/test_views.py b/lms/djangoapps/commerce/api/v0/tests/test_views.py index 07f412da07..cd884fb16e 100644 --- a/lms/djangoapps/commerce/api/v0/tests/test_views.py +++ b/lms/djangoapps/commerce/api/v0/tests/test_views.py @@ -11,8 +11,6 @@ from django.conf import settings from django.urls import reverse, reverse_lazy from django.test import TestCase from django.test.utils import override_settings -from edx_rest_api_client import exceptions -from nose.plugins.attrib import attr from course_modes.models import CourseMode from course_modes.tests.factories import CourseModeFactory @@ -36,12 +34,13 @@ UTM_COOKIE_CONTENTS = { } -@attr(shard=1) @ddt.ddt class BasketsViewTests(EnrollmentEventTestMixin, UserMixin, ModuleStoreTestCase): """ Tests for the commerce Baskets view. """ + shard = 1 + def _post_to_view(self, course_id=None, marketing_email_opt_in=False, include_utm_cookie=False): """ POST to the view being tested. @@ -280,12 +279,12 @@ class BasketsViewTests(EnrollmentEventTestMixin, UserMixin, ModuleStoreTestCase) self.assertEqual(self._post_to_view().status_code, 406) -@attr(shard=1) class BasketOrderViewTests(UserMixin, TestCase): """ Tests for the basket order view. """ view_name = 'commerce_api:v0:baskets:retrieve_order' MOCK_ORDER = {'number': 1} path = reverse_lazy(view_name, kwargs={'basket_id': 1}) + shard = 1 def setUp(self): super(BasketOrderViewTests, self).setUp() diff --git a/lms/djangoapps/commerce/api/v1/tests/test_views.py b/lms/djangoapps/commerce/api/v1/tests/test_views.py index 2a27e58945..af36ca8ec5 100644 --- a/lms/djangoapps/commerce/api/v1/tests/test_views.py +++ b/lms/djangoapps/commerce/api/v1/tests/test_views.py @@ -10,8 +10,6 @@ from django.contrib.auth.models import Permission from django.urls import reverse, reverse_lazy from django.test import TestCase from django.test.utils import override_settings -from edx_rest_api_client import exceptions -from nose.plugins.attrib import attr from rest_framework.utils.encoders import JSONEncoder from course_modes.models import CourseMode @@ -103,7 +101,6 @@ class CourseListViewTests(CourseApiViewTestMixin, ModuleStoreTestCase): self.assertListEqual(actual, expected) -@attr(shard=3) @ddt.ddt class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase): """ Tests for CourseRetrieveUpdateView. """ @@ -112,6 +109,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase) NOW: datetime.now(), None: None, } + shard = 3 def setUp(self): super(CourseRetrieveUpdateViewTests, self).setUp() @@ -394,13 +392,13 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase) self.assertDictEqual(expected_dict, json.loads(response.content)) -@attr(shard=1) class OrderViewTests(UserMixin, TestCase): """ Tests for the basket order view. """ view_name = 'commerce_api:v1:orders:detail' ORDER_NUMBER = 'EDX-100001' MOCK_ORDER = {'number': ORDER_NUMBER} path = reverse_lazy(view_name, kwargs={'number': ORDER_NUMBER}) + shard = 1 def setUp(self): super(OrderViewTests, self).setUp() diff --git a/lms/djangoapps/commerce/tests/test_views.py b/lms/djangoapps/commerce/tests/test_views.py index 9f30d07e8f..f06e68ed77 100644 --- a/lms/djangoapps/commerce/tests/test_views.py +++ b/lms/djangoapps/commerce/tests/test_views.py @@ -5,7 +5,6 @@ import json import ddt import mock from django.urls import reverse -from nose.plugins.attrib import attr from course_modes.models import CourseMode from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme @@ -27,10 +26,10 @@ class UserMixin(object): self.client.login(username=self.user.username, password='test') -@attr(shard=1) @ddt.ddt class ReceiptViewTests(UserMixin, ModuleStoreTestCase): """ Tests for the receipt view. """ + shard = 1 def setUp(self): """ diff --git a/lms/djangoapps/coursewarehistoryextended/tests.py b/lms/djangoapps/coursewarehistoryextended/tests.py index 93b8e88de5..74f6c2b5ff 100644 --- a/lms/djangoapps/coursewarehistoryextended/tests.py +++ b/lms/djangoapps/coursewarehistoryextended/tests.py @@ -11,18 +11,17 @@ from unittest import skipUnless from django.conf import settings from django.test import TestCase from mock import patch -from nose.plugins.attrib import attr from courseware.models import BaseStudentModuleHistory, StudentModule, StudentModuleHistory from courseware.tests.factories import StudentModuleFactory, course_id, location -@attr(shard=1) @skipUnless(settings.FEATURES["ENABLE_CSMH_EXTENDED"], "CSMH Extended needs to be enabled") class TestStudentModuleHistoryBackends(TestCase): """ Tests of data in CSMH and CSMHE """ # Tell Django to clean out all databases, not just default multi_db = True + shard = 1 def setUp(self): super(TestStudentModuleHistoryBackends, self).setUp() diff --git a/lms/djangoapps/discussion_api/tests/test_api.py b/lms/djangoapps/discussion_api/tests/test_api.py index 330b18273b..e59fa64a6d 100644 --- a/lms/djangoapps/discussion_api/tests/test_api.py +++ b/lms/djangoapps/discussion_api/tests/test_api.py @@ -11,7 +11,6 @@ import httpretty import mock from django.core.exceptions import ValidationError from django.test.client import RequestFactory -from nose.plugins.attrib import attr from opaque_keys.edx.locator import CourseLocator from pytz import UTC from rest_framework.exceptions import PermissionDenied @@ -50,6 +49,7 @@ from django_comment_common.models import ( from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory from openedx.core.lib.exceptions import CourseNotFoundError, PageNotFoundError +from openedx.core.lib.tests import attr from student.tests.factories import CourseEnrollmentFactory, UserFactory from util.testing import UrlResetMixin from xmodule.modulestore import ModuleStoreEnum diff --git a/lms/djangoapps/discussion_api/tests/test_permissions.py b/lms/djangoapps/discussion_api/tests/test_permissions.py index dcaf1333f9..46b24e2df2 100644 --- a/lms/djangoapps/discussion_api/tests/test_permissions.py +++ b/lms/djangoapps/discussion_api/tests/test_permissions.py @@ -4,7 +4,6 @@ Tests for discussion API permission logic import itertools import ddt -from nose.plugins.attrib import attr from discussion_api.permissions import ( can_delete, @@ -15,6 +14,7 @@ from discussion_api.permissions import ( from lms.lib.comment_client.comment import Comment from lms.lib.comment_client.thread import Thread from lms.lib.comment_client.user import User +from openedx.core.lib.tests import attr from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory diff --git a/lms/djangoapps/discussion_api/tests/test_serializers.py b/lms/djangoapps/discussion_api/tests/test_serializers.py index cfe19150a8..0d1f462f22 100644 --- a/lms/djangoapps/discussion_api/tests/test_serializers.py +++ b/lms/djangoapps/discussion_api/tests/test_serializers.py @@ -8,7 +8,6 @@ import ddt import httpretty import mock from django.test.client import RequestFactory -from nose.plugins.attrib import attr from discussion_api.serializers import CommentSerializer, ThreadSerializer, get_context from discussion_api.tests.utils import CommentsServiceMockMixin, make_minimal_cs_comment, make_minimal_cs_thread @@ -23,6 +22,7 @@ from django_comment_common.models import ( from lms.lib.comment_client.comment import Comment from lms.lib.comment_client.thread import Thread from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory +from openedx.core.lib.tests import attr from student.tests.factories import UserFactory from util.testing import UrlResetMixin from xmodule.modulestore import ModuleStoreEnum diff --git a/lms/djangoapps/discussion_api/tests/test_views.py b/lms/djangoapps/discussion_api/tests/test_views.py index 9504e2bf84..3f8deca412 100644 --- a/lms/djangoapps/discussion_api/tests/test_views.py +++ b/lms/djangoapps/discussion_api/tests/test_views.py @@ -11,7 +11,6 @@ import ddt import httpretty import mock from django.urls import reverse -from nose.plugins.attrib import attr from pytz import UTC from rest_framework.parsers import JSONParser from rest_framework.test import APIClient @@ -29,6 +28,7 @@ from discussion_api.tests.utils import ( from django_comment_client.tests.utils import ForumsEnableMixin from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_image_storage from openedx.core.djangoapps.user_api.models import RetirementState, UserRetirementStatus +from openedx.core.lib.tests import attr from openedx.core.lib.token_utils import JwtBuilder from student.models import get_retired_username_by_username from student.tests.factories import CourseEnrollmentFactory, UserFactory, SuperuserFactory diff --git a/lms/djangoapps/django_comment_client/base/tests.py b/lms/djangoapps/django_comment_client/base/tests.py index 72640ab2a9..693840ac70 100644 --- a/lms/djangoapps/django_comment_client/base/tests.py +++ b/lms/djangoapps/django_comment_client/base/tests.py @@ -6,14 +6,12 @@ import mock from contextlib import contextmanager import ddt -import pytest from django.contrib.auth.models import User from django.core.management import call_command from django.urls import reverse from django.test.client import RequestFactory from eventtracking.processors.exceptions import EventEmissionExit from mock import ANY, Mock, patch -from nose.plugins.attrib import attr from nose.tools import assert_equal, assert_true from opaque_keys.edx.keys import CourseKey from six import text_type @@ -41,6 +39,7 @@ from lms.lib.comment_client import Thread from openedx.core.djangoapps.course_groups.cohorts import set_course_cohorted from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES +from openedx.core.lib.tests import attr from student.roles import CourseStaffRole, UserBasedRole from student.tests.factories import CourseAccessRoleFactory, CourseEnrollmentFactory, UserFactory from util.testing import UrlResetMixin diff --git a/lms/djangoapps/django_comment_client/tests/mock_cs_server/test_mock_cs_server.py b/lms/djangoapps/django_comment_client/tests/mock_cs_server/test_mock_cs_server.py index def844397e..7ec2129137 100644 --- a/lms/djangoapps/django_comment_client/tests/mock_cs_server/test_mock_cs_server.py +++ b/lms/djangoapps/django_comment_client/tests/mock_cs_server/test_mock_cs_server.py @@ -3,7 +3,7 @@ import threading import unittest import urllib2 -from nose.plugins.skip import SkipTest +import pytest from django_comment_client.tests.mock_cs_server.mock_cs_server import MockCommentServiceServer @@ -21,7 +21,7 @@ class MockCommentServiceServerTest(unittest.TestCase): # This is a test of the test setup, # so it does not need to run as part of the unit test suite # You can re-enable it by commenting out the line below - raise SkipTest + pytest.skip() # Create the server server_port = 4567 diff --git a/lms/djangoapps/django_comment_client/tests/test_middleware.py b/lms/djangoapps/django_comment_client/tests/test_middleware.py index 80803bea7e..e063e83505 100644 --- a/lms/djangoapps/django_comment_client/tests/test_middleware.py +++ b/lms/djangoapps/django_comment_client/tests/test_middleware.py @@ -2,15 +2,15 @@ import json import django.http from django.test import TestCase -from nose.plugins.attrib import attr from six import text_type import django_comment_client.middleware as middleware import lms.lib.comment_client -@attr(shard=1) class AjaxExceptionTestCase(TestCase): + shard = 1 + def setUp(self): super(AjaxExceptionTestCase, self).setUp() self.a = middleware.AjaxExceptionMiddleware() diff --git a/lms/djangoapps/django_comment_client/tests/test_models.py b/lms/djangoapps/django_comment_client/tests/test_models.py index 019d267b75..dfa1cc79eb 100644 --- a/lms/djangoapps/django_comment_client/tests/test_models.py +++ b/lms/djangoapps/django_comment_client/tests/test_models.py @@ -2,7 +2,6 @@ Tests for the django comment client integration models """ from django.test.testcases import TestCase -from nose.plugins.attrib import attr from opaque_keys.edx.keys import CourseKey import django_comment_common.models as models @@ -10,12 +9,12 @@ from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_MODULESTORE, from xmodule.modulestore.tests.factories import ToyCourseFactory -@attr(shard=1) class RoleClassTestCase(ModuleStoreTestCase): """ Tests for roles of the comment client service integration """ MODULESTORE = TEST_DATA_MIXED_MODULESTORE + shard = 1 def setUp(self): super(RoleClassTestCase, self).setUp() @@ -52,11 +51,12 @@ class RoleClassTestCase(ModuleStoreTestCase): self.TA_role_2.inherit_permissions(self.TA_role) -@attr(shard=1) class PermissionClassTestCase(TestCase): """ Tests for permissions of the comment client service integration """ + shard = 1 + def setUp(self): super(PermissionClassTestCase, self).setUp() self.permission = models.Permission.objects.get_or_create(name="test")[0] diff --git a/lms/djangoapps/django_comment_client/tests/test_utils.py b/lms/djangoapps/django_comment_client/tests/test_utils.py index 24c86b2474..559a939fa2 100644 --- a/lms/djangoapps/django_comment_client/tests/test_utils.py +++ b/lms/djangoapps/django_comment_client/tests/test_utils.py @@ -4,12 +4,10 @@ import json import ddt import mock -import pytest from django.urls import reverse from django.test import RequestFactory, TestCase from mock import Mock, patch -from nose.plugins.attrib import attr from pytz import UTC from six import text_type @@ -40,6 +38,7 @@ from openedx.core.djangoapps.course_groups.cohorts import set_course_cohorted from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory, config_course_cohorts from openedx.core.djangoapps.request_cache.middleware import RequestCache from openedx.core.djangoapps.util.testing import ContentGroupTestCase +from openedx.core.lib.tests import attr from student.roles import CourseStaffRole from student.tests.factories import AdminFactory, CourseEnrollmentFactory, UserFactory from xmodule.modulestore import ModuleStoreEnum diff --git a/lms/djangoapps/edxnotes/tests.py b/lms/djangoapps/edxnotes/tests.py index 3926ca7535..fed82de63b 100644 --- a/lms/djangoapps/edxnotes/tests.py +++ b/lms/djangoapps/edxnotes/tests.py @@ -6,7 +6,6 @@ import urlparse from contextlib import contextmanager from datetime import datetime from unittest import skipUnless -import mock import ddt import jwt @@ -18,7 +17,6 @@ from django.test.client import RequestFactory from django.test.utils import override_settings from edx_oauth2_provider.tests.factories import ClientFactory from mock import MagicMock, patch -from nose.plugins.attrib import attr from provider.oauth2.models import Client from courseware.model_data import FieldDataCache @@ -30,6 +28,7 @@ from edxnotes.decorators import edxnotes from edxnotes.exceptions import EdxNotesParseError, EdxNotesServiceUnavailable from edxnotes.plugins import EdxNotesTab from openedx.core.djangoapps.user_api.models import RetirementState, UserRetirementStatus +from openedx.core.lib.tests import attr from openedx.core.lib.token_utils import JwtBuilder from student.tests.factories import CourseEnrollmentFactory, SuperuserFactory, UserFactory from xmodule.modulestore import ModuleStoreEnum diff --git a/lms/djangoapps/gating/tests/test_api.py b/lms/djangoapps/gating/tests/test_api.py index 0dfed52795..5279d1c2cf 100644 --- a/lms/djangoapps/gating/tests/test_api.py +++ b/lms/djangoapps/gating/tests/test_api.py @@ -5,7 +5,6 @@ from ddt import data, ddt, unpack from milestones import api as milestones_api from milestones.tests.utils import MilestonesTestCaseMixin from mock import Mock, patch -from nose.plugins.attrib import attr from courseware.tests.helpers import LoginEnrollmentTestCase from gating.api import evaluate_prerequisite @@ -57,12 +56,12 @@ class GatingTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): ) -@attr(shard=3) @ddt class TestEvaluatePrerequisite(GatingTestCase, MilestonesTestCaseMixin): """ Tests for the evaluate_prerequisite function """ + shard = 3 def setUp(self): super(TestEvaluatePrerequisite, self).setUp() diff --git a/lms/djangoapps/gating/tests/test_integration.py b/lms/djangoapps/gating/tests/test_integration.py index 8ba2ff58c9..55ffd00083 100644 --- a/lms/djangoapps/gating/tests/test_integration.py +++ b/lms/djangoapps/gating/tests/test_integration.py @@ -5,7 +5,6 @@ import ddt from completion import waffle as completion_waffle from milestones import api as milestones_api from milestones.tests.utils import MilestonesTestCaseMixin -from nose.plugins.attrib import attr from lms.djangoapps.courseware.access import has_access from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory @@ -19,13 +18,14 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory -@attr(shard=3) @ddt.ddt class TestGatedContent(MilestonesTestCaseMixin, SharedModuleStoreTestCase): """ Base TestCase class for setting up a basic course structure and testing the gating feature """ + shard = 3 + @classmethod def setUpClass(cls): super(TestGatedContent, cls).setUpClass() diff --git a/lms/djangoapps/grades/tests/test_course_grade_factory.py b/lms/djangoapps/grades/tests/test_course_grade_factory.py index 554a6c43d9..1df89359f7 100644 --- a/lms/djangoapps/grades/tests/test_course_grade_factory.py +++ b/lms/djangoapps/grades/tests/test_course_grade_factory.py @@ -1,8 +1,6 @@ import itertools -from nose.plugins.attrib import attr import ddt -import django from courseware.access import has_access from django.conf import settings from lms.djangoapps.grades.config.tests.utils import persistent_grades_feature_flags @@ -240,13 +238,13 @@ class TestCourseGradeFactory(GradeTestBase): self.assertEqual(expected_summary, actual_summary) -@attr(shard=1) class TestGradeIteration(SharedModuleStoreTestCase): """ Test iteration through student course grades. """ COURSE_NUM = "1000" COURSE_NAME = "grading_test_course" + shard = 1 @classmethod def setUpClass(cls): diff --git a/lms/djangoapps/instructor_analytics/tests/test_basic.py b/lms/djangoapps/instructor_analytics/tests/test_basic.py index 1d85160986..cffbeed0e0 100644 --- a/lms/djangoapps/instructor_analytics/tests/test_basic.py +++ b/lms/djangoapps/instructor_analytics/tests/test_basic.py @@ -11,7 +11,6 @@ from django.db.models import Q from edx_proctoring.api import create_exam from edx_proctoring.models import ProctoredExamStudentAttempt from mock import MagicMock, Mock, patch -from nose.plugins.attrib import attr from opaque_keys.edx.locator import UsageKey from six import text_type @@ -50,9 +49,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -@attr(shard=3) class TestAnalyticsBasic(ModuleStoreTestCase): """ Test basic analytics functions. """ + shard = 3 def setUp(self): super(TestAnalyticsBasic, self).setUp() diff --git a/lms/djangoapps/instructor_task/tests/test_api.py b/lms/djangoapps/instructor_task/tests/test_api.py index 2d9fe59cde..01ee8b94dc 100644 --- a/lms/djangoapps/instructor_task/tests/test_api.py +++ b/lms/djangoapps/instructor_task/tests/test_api.py @@ -3,7 +3,6 @@ Test for LMS instructor background task queue management """ import ddt from mock import MagicMock, Mock, patch -from nose.plugins.attrib import attr from bulk_email.models import SEND_TO_LEARNERS, SEND_TO_MYSELF, SEND_TO_STAFF, CourseEmail from lms.djangoapps.certificates.models import CertificateGenerationHistory, CertificateStatuses @@ -89,10 +88,10 @@ class InstructorTaskReportTest(InstructorTaskTestCase): self.assertEquals(set(task_ids), set()) -@attr(shard=3) @ddt.ddt class InstructorTaskModuleSubmitTest(InstructorTaskModuleTestCase): """Tests API methods that involve the submission of module-based background tasks.""" + shard = 3 def setUp(self): super(InstructorTaskModuleSubmitTest, self).setUp() @@ -211,10 +210,10 @@ class InstructorTaskModuleSubmitTest(InstructorTaskModuleTestCase): task_function(self.create_task_request(self.instructor), location, **params) -@attr(shard=3) @patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCase): """Tests API methods that involve the submission of course-based background tasks.""" + shard = 3 def setUp(self): super(InstructorTaskCourseSubmitTest, self).setUp() diff --git a/lms/djangoapps/instructor_task/tests/test_integration.py b/lms/djangoapps/instructor_task/tests/test_integration.py index 1c2ea4ec28..770e25ffc2 100644 --- a/lms/djangoapps/instructor_task/tests/test_integration.py +++ b/lms/djangoapps/instructor_task/tests/test_integration.py @@ -15,7 +15,6 @@ from celery.states import FAILURE, SUCCESS from django.contrib.auth.models import User from django.urls import reverse from mock import patch -from nose.plugins.attrib import attr from six import text_type from capa.responsetypes import StudentInputError @@ -66,7 +65,6 @@ class TestIntegrationTask(InstructorTaskModuleTestCase): self.assertEqual(status['message'], expected_message) -@attr(shard=3) @ddt.ddt class TestRescoringTask(TestIntegrationTask): """ @@ -74,6 +72,7 @@ class TestRescoringTask(TestIntegrationTask): Exercises real problems with a minimum of patching. """ + shard = 3 def setUp(self): super(TestRescoringTask, self).setUp() diff --git a/lms/djangoapps/instructor_task/tests/test_tasks.py b/lms/djangoapps/instructor_task/tests/test_tasks.py index 704b227958..87a618870e 100644 --- a/lms/djangoapps/instructor_task/tests/test_tasks.py +++ b/lms/djangoapps/instructor_task/tests/test_tasks.py @@ -13,7 +13,6 @@ import ddt from celery.states import FAILURE, SUCCESS from django.utils.translation import ugettext_noop from mock import MagicMock, Mock, patch -from nose.plugins.attrib import attr from opaque_keys.edx.locations import i4xEncoder from course_modes.models import CourseMode @@ -32,6 +31,7 @@ from lms.djangoapps.instructor_task.tasks import ( from lms.djangoapps.instructor_task.tasks_helper.misc import upload_ora2_data from lms.djangoapps.instructor_task.tests.factories import InstructorTaskFactory from lms.djangoapps.instructor_task.tests.test_base import InstructorTaskModuleTestCase +from openedx.core.lib.tests import attr from xmodule.modulestore.exceptions import ItemNotFoundError PROBLEM_URL_NAME = "test_urlname" diff --git a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py index 6f6fd348b9..cb43c584c6 100644 --- a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py +++ b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py @@ -27,7 +27,6 @@ from django.test.utils import override_settings from freezegun import freeze_time from instructor_analytics.basic import UNAVAILABLE, list_problem_responses from mock import MagicMock, Mock, patch, ANY -from nose.plugins.attrib import attr from pytz import UTC from shoppingcart.models import ( Coupon, @@ -1004,12 +1003,11 @@ class TestProblemGradeReport(TestReportMixin, InstructorTaskModuleTestCase): ]) -@attr(shard=3) class TestProblemReportSplitTestContent(TestReportMixin, TestConditionalContent, InstructorTaskModuleTestCase): """ Test the problem report on a course that has split tests. """ - + shard = 3 OPTION_1 = 'Option 1' OPTION_2 = 'Option 2' @@ -2122,13 +2120,13 @@ class TestGradeReportEnrollmentAndCertificateInfo(TestReportMixin, InstructorTas self._verify_csv_data(user.username, expected_output) -@attr(shard=3) @ddt.ddt @override_settings(CERT_QUEUE='test-queue') class TestCertificateGeneration(InstructorTaskModuleTestCase): """ Test certificate generation task works. """ + shard = 3 ENABLED_CACHES = ['default', 'mongo_metadata_inheritance', 'loc_cache'] diff --git a/lms/lib/xblock/test/test_mixin.py b/lms/lib/xblock/test/test_mixin.py index 27b2e51a5b..04ea573390 100644 --- a/lms/lib/xblock/test/test_mixin.py +++ b/lms/lib/xblock/test/test_mixin.py @@ -2,7 +2,6 @@ Tests of the LMS XBlock Mixin """ import ddt -from nose.plugins.attrib import attr from lms_xblock.mixin import ( INVALID_USER_PARTITION_GROUP_VALIDATION_COMPONENT, @@ -11,6 +10,7 @@ from lms_xblock.mixin import ( INVALID_USER_PARTITION_VALIDATION_UNIT, NONSENSICAL_ACCESS_RESTRICTION ) +from openedx.core.lib.tests import attr from xblock.validation import ValidationMessage from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.factories import CourseFactory, ToyCourseFactory, ItemFactory