TE-2524 Stop using nose.plugins
This commit is contained in:
@@ -3,7 +3,6 @@ Tests that the generate_course_overview management command actually generates co
|
||||
"""
|
||||
from django.core.management.base import CommandError
|
||||
from mock import patch
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
from openedx.core.djangoapps.content.course_overviews.management.commands import generate_course_overview
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
@@ -12,11 +11,12 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
@attr(shard=2)
|
||||
class TestGenerateCourseOverview(ModuleStoreTestCase):
|
||||
"""
|
||||
Tests course overview management command.
|
||||
"""
|
||||
shard = 2
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
Create courses in modulestore.
|
||||
|
||||
@@ -3,7 +3,6 @@ Test for the post-migration fix commands that are included with this djangoapp
|
||||
"""
|
||||
from django.core.management import call_command
|
||||
from django.test.client import RequestFactory
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
from openedx.core.djangoapps.course_groups.views import cohort_handler
|
||||
from openedx.core.djangoapps.course_groups.cohorts import get_cohort_by_name
|
||||
@@ -14,11 +13,12 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
@attr(shard=2)
|
||||
class TestPostMigrationFix(ModuleStoreTestCase):
|
||||
"""
|
||||
Base class for testing post-migration fix commands
|
||||
"""
|
||||
shard = 2
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
setup course, user and request for tests
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
Utility functions for the edx-platform test suite.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
||||
def attr(*args, **kwargs):
|
||||
"""
|
||||
Set the given attributes on the decorated test class, function or method.
|
||||
Replacement for nose.plugins.attrib.attr, used with pytest-attrib to
|
||||
run tests with particular attributes.
|
||||
"""
|
||||
def decorator(test):
|
||||
"""
|
||||
Apply the decorator's arguments as arguments to the given test.
|
||||
"""
|
||||
for arg in args:
|
||||
setattr(test, arg, True)
|
||||
for key in kwargs:
|
||||
setattr(test, key, kwargs[key])
|
||||
return test
|
||||
return decorator
|
||||
|
||||
Reference in New Issue
Block a user