REsolved conflicts

This commit is contained in:
Jawayria
2021-02-03 17:10:39 +05:00
175 changed files with 586 additions and 578 deletions

View File

@@ -21,4 +21,4 @@ kombu.utils.entrypoints = lambda namespace: iter([])
# This will make sure the app is always imported when Django starts so
# that shared_task will use this app, and also ensures that the celery
# singleton is always configured for the CMS.
from .celery import APP as CELERY_APP
from .celery import APP as CELERY_APP # lint-amnesty, pylint: disable=wrong-import-position

View File

@@ -1,4 +1,4 @@
"""
""" # lint-amnesty, pylint: disable=django-not-configured
Import celery, load its settings from the django settings
and auto discover tasks in all installed django apps.

View File

@@ -53,7 +53,7 @@ def _django_clear_site_cache():
clearing mechanism actually works. So override this fixture to not mess
with what has been working for us so far.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
@pytest.fixture(autouse=True)

View File

@@ -80,7 +80,7 @@ admin.site.register(CourseCreator, CourseCreatorAdmin)
@receiver(update_creator_state, sender=CourseCreator)
def update_creator_group_callback(sender, **kwargs):
def update_creator_group_callback(sender, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Callback for when the model's creator status has changed.
"""
@@ -90,7 +90,7 @@ def update_creator_group_callback(sender, **kwargs):
@receiver(send_user_notification, sender=CourseCreator)
def send_user_notification_callback(sender, **kwargs):
def send_user_notification_callback(sender, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Callback for notifying user about course creator status change.
"""
@@ -113,12 +113,12 @@ def send_user_notification_callback(sender, **kwargs):
try:
user.email_user(subject, message, studio_request_email)
except:
except: # lint-amnesty, pylint: disable=bare-except
log.warning(u"Unable to send course creator status e-mail to %s", user.email)
@receiver(send_admin_notification, sender=CourseCreator)
def send_admin_notification_callback(sender, **kwargs):
def send_admin_notification_callback(sender, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Callback for notifying admin of a user in the 'pending' state.
"""

View File

@@ -3,7 +3,7 @@ Table for storing information about whether or not Studio users have course crea
"""
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.db import models
from django.db.models.signals import post_init, post_save
from django.dispatch import Signal, receiver
@@ -54,7 +54,7 @@ class CourseCreator(models.Model):
@receiver(post_init, sender=CourseCreator)
def post_init_callback(sender, **kwargs):
def post_init_callback(sender, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Extend to store previous state.
"""

View File

@@ -5,7 +5,7 @@ Tests course_creators.admin.py.
import mock
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.core import mail
from django.http import HttpRequest
from django.test import TestCase
@@ -29,7 +29,7 @@ class CourseCreatorAdminTest(TestCase):
def setUp(self):
""" Test case setup """
super(CourseCreatorAdminTest, self).setUp()
super(CourseCreatorAdminTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user = User.objects.create_user('test_user', 'test_user+courses@edx.org', 'foo')
self.table_entry = CourseCreator(user=self.user)
self.table_entry.save()

View File

@@ -4,7 +4,7 @@ Tests course_creators.views.py.
import mock
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.core.exceptions import PermissionDenied
from django.test import TestCase
from django.urls import reverse
@@ -27,7 +27,7 @@ class CourseCreatorView(TestCase):
def setUp(self):
""" Test case setup """
super(CourseCreatorView, self).setUp()
super(CourseCreatorView, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user = User.objects.create_user('test_user', 'test_user+courses@edx.org', 'foo')
self.admin = User.objects.create_user('Mark', 'admin+courses@edx.org', 'foo')
self.admin.is_staff = True

View File

@@ -30,7 +30,7 @@ class TestMaintenanceIndex(ModuleStoreTestCase):
"""
def setUp(self):
super(TestMaintenanceIndex, self).setUp()
super(TestMaintenanceIndex, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user = AdminFactory()
login_success = self.client.login(username=self.user.username, password='test')
self.assertTrue(login_success)
@@ -56,7 +56,7 @@ class MaintenanceViewTestCase(ModuleStoreTestCase):
view_url = ''
def setUp(self):
super(MaintenanceViewTestCase, self).setUp()
super(MaintenanceViewTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user = AdminFactory()
login_success = self.client.login(username=self.user.username, password='test')
self.assertTrue(login_success)
@@ -73,7 +73,7 @@ class MaintenanceViewTestCase(ModuleStoreTestCase):
Reverse the setup.
"""
self.client.logout()
super(MaintenanceViewTestCase, self).tearDown()
super(MaintenanceViewTestCase, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
@ddt.ddt
@@ -131,7 +131,7 @@ class TestForcePublish(MaintenanceViewTestCase):
"""
def setUp(self):
super(TestForcePublish, self).setUp()
super(TestForcePublish, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.view_url = reverse('maintenance:force_publish_course')
def setup_test_course(self):
@@ -271,7 +271,7 @@ class TestAnnouncementsViews(MaintenanceViewTestCase):
"""
def setUp(self):
super(TestAnnouncementsViews, self).setUp()
super(TestAnnouncementsViews, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.admin = AdminFactory.create(
email='staff@edx.org',
username='admin',

View File

@@ -84,7 +84,7 @@ class MaintenanceBaseView(View):
template = 'maintenance/container.html'
def __init__(self, view=None):
super(MaintenanceBaseView, self).__init__()
super(MaintenanceBaseView, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.context = {
'view': view if view else '',
'form_data': {},
@@ -142,7 +142,7 @@ class ForcePublishCourseView(MaintenanceBaseView):
"""
def __init__(self):
super(ForcePublishCourseView, self).__init__(MAINTENANCE_VIEWS['force_publish_course'])
super(ForcePublishCourseView, self).__init__(MAINTENANCE_VIEWS['force_publish_course']) # lint-amnesty, pylint: disable=super-with-arguments
self.context.update({
'current_versions': [],
'updated_versions': [],
@@ -238,7 +238,7 @@ class AnnouncementBaseView(View):
@method_decorator(require_global_staff)
def dispatch(self, request, *args, **kwargs):
return super(AnnouncementBaseView, self).dispatch(request, *args, **kwargs)
return super(AnnouncementBaseView, self).dispatch(request, *args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
class AnnouncementIndexView(ListView, MaintenanceBaseView):
@@ -251,10 +251,10 @@ class AnnouncementIndexView(ListView, MaintenanceBaseView):
paginate_by = 8
def __init__(self):
super(AnnouncementIndexView, self).__init__(MAINTENANCE_VIEWS['announcement_index'])
super(AnnouncementIndexView, self).__init__(MAINTENANCE_VIEWS['announcement_index']) # lint-amnesty, pylint: disable=super-with-arguments
def get_context_data(self, **kwargs):
context = super(AnnouncementIndexView, self).get_context_data(**kwargs)
context = super(AnnouncementIndexView, self).get_context_data(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
context['view'] = MAINTENANCE_VIEWS['announcement_index']
return context
@@ -274,7 +274,7 @@ class AnnouncementEditView(UpdateView, AnnouncementBaseView):
template_name = '/maintenance/_announcement_edit.html'
def get_context_data(self, **kwargs):
context = super(AnnouncementEditView, self).get_context_data(**kwargs)
context = super(AnnouncementEditView, self).get_context_data(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
context['action_url'] = reverse('maintenance:announcement_edit', kwargs={'pk': context['announcement'].pk})
return context
@@ -289,7 +289,7 @@ class AnnouncementCreateView(CreateView, AnnouncementBaseView):
template_name = '/maintenance/_announcement_edit.html'
def get_context_data(self, **kwargs):
context = super(AnnouncementCreateView, self).get_context_data(**kwargs)
context = super(AnnouncementCreateView, self).get_context_data(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
context['action_url'] = reverse('maintenance:announcement_create')
return context

View File

@@ -235,7 +235,7 @@ class CourseGradingModel(object):
# 'minimum_grade_credit' cannot be set to None
if minimum_grade_credit is not None:
minimum_grade_credit = minimum_grade_credit
minimum_grade_credit = minimum_grade_credit # lint-amnesty, pylint: disable=self-assigning-variable
descriptor.minimum_grade_credit = minimum_grade_credit
modulestore().update_item(descriptor, user.id)
@@ -276,7 +276,7 @@ class CourseGradingModel(object):
}
@staticmethod
def update_section_grader_type(descriptor, grader_type, user):
def update_section_grader_type(descriptor, grader_type, user): # lint-amnesty, pylint: disable=missing-function-docstring
if grader_type is not None and grader_type != u'notgraded':
descriptor.format = grader_type
descriptor.graded = True
@@ -289,7 +289,7 @@ class CourseGradingModel(object):
return {'graderType': grader_type}
@staticmethod
def convert_set_grace_period(descriptor):
def convert_set_grace_period(descriptor): # lint-amnesty, pylint: disable=missing-function-docstring
# 5 hours 59 minutes 59 seconds => converted to iso format
rawgrace = descriptor.graceperiod
if rawgrace:
@@ -316,7 +316,7 @@ class CourseGradingModel(object):
return None
@staticmethod
def parse_grader(json_grader):
def parse_grader(json_grader): # lint-amnesty, pylint: disable=missing-function-docstring
# manual to clear out kruft
result = {"type": json_grader["type"],
"min_count": int(json_grader.get('min_count', 0)),
@@ -328,7 +328,7 @@ class CourseGradingModel(object):
return result
@staticmethod
def jsonize_grader(i, grader):
def jsonize_grader(i, grader): # lint-amnesty, pylint: disable=missing-function-docstring
# Warning: converting weight to integer might give unwanted results due
# to the reason how floating point arithmetic works
# e.g, "0.29 * 100 = 28.999999999999996"
@@ -342,7 +342,7 @@ class CourseGradingModel(object):
}
def _grading_event_and_signal(course_key, user_id):
def _grading_event_and_signal(course_key, user_id): # lint-amnesty, pylint: disable=missing-function-docstring
name = GRADING_POLICY_CHANGED_EVENT_TYPE
course = modulestore().get_course(course_key)
grading_policy_hash = six.text_type(hash_grading_policy(course.grading_policy))
@@ -362,7 +362,7 @@ def _grading_event_and_signal(course_key, user_id):
)
def hash_grading_policy(grading_policy):
def hash_grading_policy(grading_policy): # lint-amnesty, pylint: disable=missing-function-docstring
ordered_policy = json.dumps(
grading_policy,
separators=(',', ':'), # Remove spaces from separators for more compact representation

View File

@@ -173,14 +173,14 @@ class CourseMetadata(object):
if field.scope != Scope.settings:
continue
field_help = _(field.help)
field_help = _(field.help) # lint-amnesty, pylint: disable=translation-of-non-string
help_args = field.runtime_options.get('help_format_args')
if help_args is not None:
field_help = field_help.format(**help_args)
result[field.name] = {
'value': field.read_json(descriptor),
'display_name': _(field.display_name),
'display_name': _(field.display_name), # lint-amnesty, pylint: disable=translation-of-non-string
'help': field_help,
'deprecated': field.runtime_options.get('deprecated', False),
'hide_on_enabled_publisher': field.runtime_options.get('hide_on_enabled_publisher', False)
@@ -211,7 +211,7 @@ class CourseMetadata(object):
if hasattr(descriptor, key) and getattr(descriptor, key) != val:
key_values[key] = descriptor.fields[key].from_json(val)
except (TypeError, ValueError) as err:
raise ValueError(_(u"Incorrect format for field '{name}'. {detailed_message}").format(
raise ValueError(_(u"Incorrect format for field '{name}'. {detailed_message}").format( # lint-amnesty, pylint: disable=raise-missing-from
name=model['display_name'], detailed_message=text_type(err)))
return cls.update_from_dict(key_values, descriptor, user)

View File

@@ -20,7 +20,7 @@ class CourseSettingsEncoder(json.JSONEncoder):
Serialize CourseDetails, CourseGradingModel, datetime, and old
Locations
"""
def default(self, obj): # pylint: disable=method-hidden
def default(self, obj): # lint-amnesty, pylint: disable=arguments-differ, method-hidden
if isinstance(obj, (CourseDetails, CourseGradingModel)):
return obj.__dict__
elif isinstance(obj, Location):

View File

@@ -34,7 +34,7 @@ class TestLTIConsumerHideFieldsFlag(TestCase):
These are set via Django admin settings.
"""
def setUp(self):
super(TestLTIConsumerHideFieldsFlag, self).setUp()
super(TestLTIConsumerHideFieldsFlag, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course_id = CourseLocator(org="edx", course="course", run="run")
@ddt.data(

View File

@@ -107,7 +107,7 @@ DEBUG_TOOLBAR_CONFIG = {
}
def should_show_debug_toolbar(request):
def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing-function-docstring
# We always want the toolbar on devstack unless running tests from another Docker container
hostname = request.get_host()
if hostname.startswith('edx.devstack.studio:') or hostname.startswith('studio.devstack.edx:'):
@@ -195,7 +195,7 @@ JWT_AUTH.update({
),
})
# pylint: enable=unicode-format-string
# pylint: enable=unicode-format-string # lint-amnesty, pylint: disable=bad-option-value
IDA_LOGOUT_URI_LIST = [
'http://localhost:18130/logout/', # ecommerce

View File

@@ -150,7 +150,7 @@ JWT_AUTH.update({
),
})
# pylint: enable=unicode-format-string
# pylint: enable=unicode-format-string # lint-amnesty, pylint: disable=bad-option-value
IDA_LOGOUT_URI_LIST = [
'http://localhost:18130/logout/', # ecommerce

View File

@@ -19,7 +19,7 @@ invoked each time that changes have been made.
"""
import os
import os # lint-amnesty, pylint: disable=unused-import
########################## Devstack settings ###################################

View File

@@ -12,7 +12,7 @@ In two separate processes on devstack:
"""
import os
import os # lint-amnesty, pylint: disable=unused-import
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files

View File

@@ -22,9 +22,9 @@ from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
from .common import *
from openedx.core.lib.derived import derive_settings
from openedx.core.lib.logsettings import get_logger_config
from xmodule.modulestore.modulestore_settings import convert_module_store_setting_if_needed
from openedx.core.lib.derived import derive_settings # lint-amnesty, pylint: disable=wrong-import-order
from openedx.core.lib.logsettings import get_logger_config # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.modulestore_settings import convert_module_store_setting_if_needed # lint-amnesty, pylint: disable=wrong-import-order
def get_env_setting(setting):
@@ -33,7 +33,7 @@ def get_env_setting(setting):
return os.environ[setting]
except KeyError:
error_msg = u"Set the %s env variable" % setting
raise ImproperlyConfigured(error_msg)
raise ImproperlyConfigured(error_msg) # lint-amnesty, pylint: disable=raise-missing-from
############### ALWAYS THE SAME ################################

View File

@@ -75,7 +75,7 @@ COMMON_TEST_DATA_ROOT = COMMON_ROOT / "test" / "data"
FEATURES['ENABLE_EXPORT_GIT'] = True
GIT_REPO_EXPORT_DIR = TEST_ROOT / "export_course_repos"
# TODO (cpennington): We need to figure out how envs/test.py can inject things into common.py so that we don't have to repeat this sort of thing
# TODO (cpennington): We need to figure out how envs/test.py can inject things into common.py so that we don't have to repeat this sort of thing # lint-amnesty, pylint: disable=line-too-long
STATICFILES_DIRS = [
COMMON_ROOT / "static",
PROJECT_ROOT / "static",

View File

@@ -21,7 +21,7 @@ class CmsFieldData(SplitFieldData):
self._authored_data = authored_data
self._student_data = student_data
super(CmsFieldData, self).__init__({
super(CmsFieldData, self).__init__({ # lint-amnesty, pylint: disable=super-with-arguments
Scope.content: authored_data,
Scope.settings: authored_data,
Scope.parent: authored_data,

View File

@@ -77,7 +77,7 @@ class StructuredTagsAside(XBlockAside):
return Fragment(u'')
@XBlock.handler
def save_tags(self, request=None, suffix=None):
def save_tags(self, request=None, suffix=None): # lint-amnesty, pylint: disable=unused-argument
"""
Handler to save choosen tags with connected XBlock
"""

View File

@@ -39,7 +39,7 @@ class StructuredTagsAsideTestCase(ModuleStoreTestCase):
"""
Preparation for the test execution
"""
super(StructuredTagsAsideTestCase, self).setUp()
super(StructuredTagsAsideTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.aside_name = 'tagging_aside'
self.aside_tag_dif = 'difficulty'
self.aside_tag_dif_value = 'Hard'
@@ -113,7 +113,7 @@ class StructuredTagsAsideTestCase(ModuleStoreTestCase):
def tearDown(self):
TagAvailableValues.objects.all().delete()
TagCategories.objects.all().delete()
super(StructuredTagsAsideTestCase, self).tearDown()
super(StructuredTagsAsideTestCase, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
def test_aside_contains_tags(self):
"""
@@ -181,11 +181,11 @@ class StructuredTagsAsideTestCase(ModuleStoreTestCase):
self.assertEqual(option_values2, ['Learned a few things', 'Learned everything', 'Learned nothing'])
# Now ensure the acid_aside is not in the result
self.assertNotRegexpMatches(problem_html, r"data-block-type=[\"\']acid_aside[\"\']")
self.assertNotRegexpMatches(problem_html, r"data-block-type=[\"\']acid_aside[\"\']") # lint-amnesty, pylint: disable=deprecated-method
# Ensure about video don't have asides
video_html = get_preview_fragment(request, self.video, context).content
self.assertNotRegexpMatches(video_html, "<select")
self.assertNotRegexpMatches(video_html, "<select") # lint-amnesty, pylint: disable=deprecated-method
@ddt.data(AsideUsageKeyV1, AsideUsageKeyV2)
def test_handle_requests(self, aside_key_class):

View File

@@ -23,8 +23,8 @@ class AuthoringMixinTestCase(ModuleStoreTestCase):
"""
GROUP_NO_LONGER_EXISTS = "This group no longer exists"
NO_CONTENT_OR_ENROLLMENT_GROUPS = "Access to this component is not restricted"
NO_CONTENT_ENROLLMENT_TRACK_ENABLED = "You can restrict access to this component to learners in specific enrollment tracks or content groups"
NO_CONTENT_ENROLLMENT_TRACK_DISABLED = "You can restrict access to this component to learners in specific content groups"
NO_CONTENT_ENROLLMENT_TRACK_ENABLED = "You can restrict access to this component to learners in specific enrollment tracks or content groups" # lint-amnesty, pylint: disable=line-too-long
NO_CONTENT_ENROLLMENT_TRACK_DISABLED = "You can restrict access to this component to learners in specific content groups" # lint-amnesty, pylint: disable=line-too-long
CONTENT_GROUPS_TITLE = "Content Groups"
ENROLLMENT_GROUPS_TITLE = "Enrollment Track Groups"
STAFF_LOCKED = 'The unit that contains this component is hidden from learners'
@@ -36,7 +36,7 @@ class AuthoringMixinTestCase(ModuleStoreTestCase):
"""
Create a simple course with a video component.
"""
super(AuthoringMixinTestCase, self).setUp()
super(AuthoringMixinTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course = CourseFactory.create()
chapter = ItemFactory.create(
category='chapter',

View File

@@ -15,7 +15,7 @@ class TestHandlerUrl(TestCase):
"""Test the LMS handler_url"""
def setUp(self):
super(TestHandlerUrl, self).setUp()
super(TestHandlerUrl, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.block = Mock()
def test_trailing_characters(self):

View File

@@ -16,16 +16,16 @@ from safe_lxml import defuse_xml_libs
defuse_xml_libs()
# Disable PyContract contract checking when running as a webserver
import contracts
import contracts # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position
contracts.disable_all()
import os
import os # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cms.envs.aws")
import cms.startup as startup
import cms.startup as startup # lint-amnesty, pylint: disable=wrong-import-position
startup.run()
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application
from django.core.wsgi import get_wsgi_application # lint-amnesty, pylint: disable=wrong-import-order, wrong-import-position
application = get_wsgi_application()

View File

@@ -26,9 +26,9 @@ class GlobalStatusMessage(ConfigurationModel):
blank=True,
null=True,
help_text=u'<p>The contents of this field will be displayed as a warning banner on all views.</p>'
u'<p>To override the banner message for a specific course, refer to the Course Message configuration. '
u'<p>To override the banner message for a specific course, refer to the Course Message configuration. ' # lint-amnesty, pylint: disable=line-too-long
u'Course Messages will only work if the global status message is enabled, so if you only want to add '
u'a banner to specific courses without adding a global status message, you should add a global status '
u'a banner to specific courses without adding a global status message, you should add a global status ' # lint-amnesty, pylint: disable=line-too-long
u'message with <strong>empty</strong> message text.</p>'
u'<p>Finally, disable the global status message by adding another empty message with "enabled" '
u'unchecked.</p>')

View File

@@ -21,7 +21,7 @@ class TestStatus(TestCase):
"""Test that the get_site_status_msg function does the right thing"""
def setUp(self):
super(TestStatus, self).setUp()
super(TestStatus, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# Clear the cache between test runs.
cache.clear()
self.course_key = CourseLocator(org='TestOrg', course='TestCourse', run='TestRun')

View File

@@ -11,9 +11,9 @@ import six.moves.urllib.parse
from .http import StubHttpRequestHandler, StubHttpService
class StubCatalogServiceHandler(StubHttpRequestHandler):
class StubCatalogServiceHandler(StubHttpRequestHandler): # lint-amnesty, pylint: disable=missing-class-docstring
def do_GET(self):
def do_GET(self): # lint-amnesty, pylint: disable=missing-function-docstring
pattern_handlers = {
r'/api/v1/programs/$': self.program_list,
r'/api/v1/programs/([0-9a-f-]+)/$': self.program_detail,

View File

@@ -11,13 +11,13 @@ import six.moves.urllib.parse
from .http import StubHttpRequestHandler, StubHttpService
class StubCommentsServiceHandler(StubHttpRequestHandler):
class StubCommentsServiceHandler(StubHttpRequestHandler): # lint-amnesty, pylint: disable=missing-class-docstring
@property
def _params(self):
return six.moves.urllib.parse.parse_qs(six.moves.urllib.parse.urlparse(self.path).query)
def do_GET(self):
def do_GET(self): # lint-amnesty, pylint: disable=missing-function-docstring
pattern_handlers = OrderedDict([
("/api/v1/users/(?P<user_id>\\d+)/active_threads$", self.do_user_profile),
("/api/v1/users/(?P<user_id>\\d+)$", self.do_user),
@@ -32,7 +32,7 @@ class StubCommentsServiceHandler(StubHttpRequestHandler):
self.send_response(404, content="404 Not Found")
def match_pattern(self, pattern_handlers):
def match_pattern(self, pattern_handlers): # lint-amnesty, pylint: disable=missing-function-docstring
path = six.moves.urllib.parse.urlparse(self.path).path
for pattern in pattern_handlers:
match = re.match(pattern, path)
@@ -51,11 +51,11 @@ class StubCommentsServiceHandler(StubHttpRequestHandler):
return
self.send_response(204, "")
def do_put_user(self, user_id):
def do_put_user(self, user_id): # lint-amnesty, pylint: disable=unused-argument
self.server.config['default_sort_key'] = self.post_dict.get("default_sort_key", "date")
self.send_json_response({'username': self.post_dict.get("username"), 'external_id': self.post_dict.get("external_id")})
self.send_json_response({'username': self.post_dict.get("username"), 'external_id': self.post_dict.get("external_id")}) # lint-amnesty, pylint: disable=line-too-long
def do_DELETE(self):
def do_DELETE(self): # lint-amnesty, pylint: disable=missing-function-docstring
pattern_handlers = {
"/api/v1/comments/(?P<comment_id>\\w+)$": self.do_delete_comment
}
@@ -63,7 +63,7 @@ class StubCommentsServiceHandler(StubHttpRequestHandler):
return
self.send_json_response({})
def do_user(self, user_id):
def do_user(self, user_id): # lint-amnesty, pylint: disable=missing-function-docstring
response = {
"id": user_id,
"default_sort_key": self.server.config.get("default_sort_key", "date"),
@@ -78,7 +78,7 @@ class StubCommentsServiceHandler(StubHttpRequestHandler):
})
self.send_json_response(response)
def do_user_profile(self, user_id):
def do_user_profile(self, user_id): # lint-amnesty, pylint: disable=missing-function-docstring, unused-argument
if 'active_threads' in self.server.config:
user_threads = self.server.config['active_threads'][:]
params = self._params
@@ -94,13 +94,13 @@ class StubCommentsServiceHandler(StubHttpRequestHandler):
else:
self.send_response(404, content="404 Not Found")
def do_thread(self, thread_id):
def do_thread(self, thread_id): # lint-amnesty, pylint: disable=missing-function-docstring
if thread_id in self.server.config.get('threads', {}):
thread = self.server.config['threads'][thread_id].copy()
params = six.moves.urllib.parse.parse_qs(six.moves.urllib.parse.urlparse(self.path).query)
if "recursive" in params and params["recursive"][0] == "True":
thread.setdefault('children', [])
resp_total = thread.setdefault('resp_total', len(thread['children']))
resp_total = thread.setdefault('resp_total', len(thread['children'])) # lint-amnesty, pylint: disable=unused-variable
resp_skip = int(params.get("resp_skip", ["0"])[0])
resp_limit = int(params.get("resp_limit", ["10000"])[0])
thread['children'] = thread['children'][resp_skip:(resp_skip + resp_limit)]

View File

@@ -107,7 +107,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler):
self.send_response(200, headers={
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "Content-Length, Content-Type, X-Annotator-Auth-Token, X-Requested-With, X-Annotator-Auth-Token, X-Requested-With, X-CSRFToken",
"Access-Control-Allow-Headers": "Content-Length, Content-Type, X-Annotator-Auth-Token, X-Requested-With, X-Annotator-Auth-Token, X-Requested-With, X-CSRFToken", # lint-amnesty, pylint: disable=line-too-long
})
def respond(self, status_code=200, content=None):
@@ -300,7 +300,7 @@ class StubEdxNotesService(StubHttpService):
HANDLER_CLASS = StubEdxNotesServiceHandler
def __init__(self, *args, **kwargs):
super(StubEdxNotesService, self).__init__(*args, **kwargs)
super(StubEdxNotesService, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.notes = list()
def get_all_notes(self):

View File

@@ -117,7 +117,7 @@ class StubHttpRequestHandler(BaseHTTPRequestHandler, object):
for key, list_val in post_dict.items()
}
except:
except: # lint-amnesty, pylint: disable=bare-except
return dict()
@lazy

View File

@@ -78,7 +78,7 @@ def _parse_config_args(args):
if len(components) >= 2:
config_dict[components[0]] = "=".join(components[1:])
except:
except: # lint-amnesty, pylint: disable=bare-except
print("Warning: could not interpret config value '{0}'".format(config_str))
return config_dict

View File

@@ -24,7 +24,7 @@ class StubEdxNotesServiceTest(unittest.TestCase):
"""
Start the stub server.
"""
super(StubEdxNotesServiceTest, self).setUp()
super(StubEdxNotesServiceTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.server = StubEdxNotesService()
dummy_notes = self._get_dummy_notes(count=5)
self.server.add_notes(dummy_notes)

View File

@@ -12,10 +12,10 @@ import six
from common.djangoapps.terrain.stubs.http import StubHttpRequestHandler, StubHttpService, require_params
class StubHttpServiceTest(unittest.TestCase):
class StubHttpServiceTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def setUp(self):
super(StubHttpServiceTest, self).setUp()
super(StubHttpServiceTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.server = StubHttpService()
self.addCleanup(self.server.shutdown)
self.url = "http://127.0.0.1:{0}/set_config".format(self.server.port)
@@ -71,7 +71,7 @@ class StubHttpServiceTest(unittest.TestCase):
self.assertEqual(response.status_code, 404)
class RequireRequestHandler(StubHttpRequestHandler):
class RequireRequestHandler(StubHttpRequestHandler): # lint-amnesty, pylint: disable=missing-class-docstring
@require_params('GET', 'test_param')
def do_GET(self):
self.send_response(200)
@@ -91,7 +91,7 @@ class RequireParamTest(unittest.TestCase):
"""
def setUp(self):
super(RequireParamTest, self).setUp()
super(RequireParamTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.server = RequireHttpService()
self.addCleanup(self.server.shutdown)
self.url = "http://127.0.0.1:{port}".format(port=self.server.port)

View File

@@ -20,7 +20,7 @@ class StubLtiServiceTest(unittest.TestCase):
Used for lettuce BDD tests in lms/courseware/features/lti.feature
"""
def setUp(self):
super(StubLtiServiceTest, self).setUp()
super(StubLtiServiceTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.server = StubLtiService()
self.uri = 'http://127.0.0.1:{}/'.format(self.server.port)
self.launch_uri = self.uri + 'correct_lti_endpoint'
@@ -60,7 +60,7 @@ class StubLtiServiceTest(unittest.TestCase):
self.assertIn(b'Wrong LTI signature', response.content)
@patch('common.djangoapps.terrain.stubs.lti.signature.verify_hmac_sha1', return_value=True)
def test_success_response_launch_lti(self, check_oauth):
def test_success_response_launch_lti(self, check_oauth): # lint-amnesty, pylint: disable=unused-argument
"""
Success lti launch.
"""

View File

@@ -33,7 +33,7 @@ class StubVideoServiceTest(unittest.TestCase):
"""
Start the stub server.
"""
super(StubVideoServiceTest, self).setUp()
super(StubVideoServiceTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.server = VideoSourceHttpService()
self.server.config['root_dir'] = '{}/data/video'.format(settings.TEST_ROOT)
self.addCleanup(self.server.shutdown)

View File

@@ -17,17 +17,17 @@ class FakeTimer(object):
"""
Fake timer implementation that executes immediately.
"""
def __init__(self, delay, func):
def __init__(self, delay, func): # lint-amnesty, pylint: disable=unused-argument
self.func = func
def start(self):
self.func()
class StubXQueueServiceTest(unittest.TestCase):
class StubXQueueServiceTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def setUp(self):
super(StubXQueueServiceTest, self).setUp()
super(StubXQueueServiceTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.server = StubXQueueService()
self.url = "http://127.0.0.1:{0}/xqueue/submit".format(self.server.port)
self.addCleanup(self.server.shutdown)
@@ -119,7 +119,7 @@ class StubXQueueServiceTest(unittest.TestCase):
self.assertFalse(self.post.called)
self.assertTrue(logger.error.called)
def _post_submission(self, callback_url, lms_key, queue_name, xqueue_body):
def _post_submission(self, callback_url, lms_key, queue_name, xqueue_body): # lint-amnesty, pylint: disable=unused-argument
"""
Post a submission to the stub XQueue implementation.
`callback_url` is the URL at which we expect to receive a grade response

View File

@@ -10,10 +10,10 @@ import requests
from ..youtube import StubYouTubeService
class StubYouTubeServiceTest(unittest.TestCase):
class StubYouTubeServiceTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def setUp(self):
super(StubYouTubeServiceTest, self).setUp()
super(StubYouTubeServiceTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.server = StubYouTubeService()
self.url = "http://127.0.0.1:{0}/".format(self.server.port)
self.server.config['time_to_response'] = 0.0

View File

@@ -91,7 +91,7 @@ class StubYouTubeHandler(StubHttpRequestHandler):
youtube_id = params.path.split('/').pop()
if self.server.config.get('youtube_api_private_video'):
self._send_private_video_response(youtube_id, "I'm youtube private video.")
self._send_private_video_response(youtube_id, "I'm youtube private video.") # lint-amnesty, pylint: disable=too-many-function-args
else:
self._send_video_response(youtube_id, "I'm youtube.")

View File

@@ -1,3 +1,4 @@
# lint-amnesty, pylint: disable=django-not-configured
"""
Utility functions related to databases.
"""
@@ -5,7 +6,7 @@ Utility functions related to databases.
import random
# TransactionManagementError used below actually *does* derive from the standard "Exception" class.
# lint-amnesty, pylint: disable=bad-option-value, nonstandard-exception
# lint-amnesty, pylint: disable=bad-option-value, nonstandard-exception
from contextlib import contextmanager
from functools import wraps # lint-amnesty, pylint: disable=unused-import

View File

@@ -1,4 +1,4 @@
# lint-amnesty, pylint: disable=missing-module-docstring
# lint-amnesty, pylint: disable=missing-module-docstring
import decimal
import json

View File

@@ -7,7 +7,7 @@ from config_models.admin import ConfigurationModelAdmin, KeyedConfigurationModel
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from common.djangoapps.xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, XBlockStudioConfigurationFlag
from common.djangoapps.xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, XBlockStudioConfigurationFlag # lint-amnesty, pylint: disable=line-too-long
class XBlockConfigurationAdmin(KeyedConfigurationModelAdmin):

View File

@@ -7,7 +7,7 @@ import six
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from common.djangoapps.xblock_django.api import authorable_xblocks, deprecated_xblocks, disabled_xblocks
from common.djangoapps.xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, XBlockStudioConfigurationFlag
from common.djangoapps.xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, XBlockStudioConfigurationFlag # lint-amnesty, pylint: disable=line-too-long
class XBlockSupportTestCase(CacheIsolationTestCase):
@@ -15,7 +15,7 @@ class XBlockSupportTestCase(CacheIsolationTestCase):
Tests for XBlock Support methods.
"""
def setUp(self):
super(XBlockSupportTestCase, self).setUp()
super(XBlockSupportTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# Set up XBlockConfigurations for disabled and deprecated states
block_config = [

View File

@@ -26,7 +26,7 @@ class UserServiceTestCase(TestCase):
Tests for the DjangoXBlockUserService.
"""
def setUp(self):
super(UserServiceTestCase, self).setUp()
super(UserServiceTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user = UserFactory(username="tester", email="test@tester.com")
self.user.profile.name = "Test Tester"
set_user_preference(self.user, 'pref-lang', 'en')

View File

@@ -3,7 +3,7 @@ Support for converting a django user to an XBlock user
"""
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from opaque_keys.edx.keys import CourseKey
from xblock.reference.user_service import UserService, XBlockUser
@@ -24,7 +24,7 @@ class DjangoXBlockUserService(UserService):
A user service that converts Django users to XBlockUser
"""
def __init__(self, django_user, **kwargs):
super(DjangoXBlockUserService, self).__init__(**kwargs)
super(DjangoXBlockUserService, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self._django_user = django_user
if self._django_user:
self._django_user.user_is_staff = kwargs.get('user_is_staff', False)

View File

@@ -6,7 +6,7 @@ Common code shared by course and library fixtures.
import json
import requests
import six
import six # lint-amnesty, pylint: disable=unused-import
from lazy import lazy
from common.test.acceptance.fixtures import STUDIO_BASE_URL
@@ -16,7 +16,7 @@ class StudioApiLoginError(Exception):
"""
Error occurred while logging in to the Studio API.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class StudioApiFixture(object):
@@ -57,7 +57,7 @@ class StudioApiFixture(object):
Log in as a staff user, then return the cookies for the session (as a dict)
Raises a `StudioApiLoginError` if the login fails.
"""
return {key: val for key, val in self.session.cookies.items()}
return {key: val for key, val in self.session.cookies.items()} # lint-amnesty, pylint: disable=unnecessary-comprehension
@lazy
def headers(self):
@@ -75,7 +75,7 @@ class FixtureError(Exception):
"""
Error occurred while installing a course or library fixture.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class XBlockContainerFixture(StudioApiFixture):
@@ -85,7 +85,7 @@ class XBlockContainerFixture(StudioApiFixture):
def __init__(self):
self.children = []
super(XBlockContainerFixture, self).__init__()
super(XBlockContainerFixture, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
def add_children(self, *args):
"""
@@ -133,7 +133,7 @@ class XBlockContainerFixture(StudioApiFixture):
loc = response.json().get('locator')
xblock_desc.locator = loc
except ValueError:
raise FixtureError(u"Could not decode JSON from '{0}'".format(response.content))
raise FixtureError(u"Could not decode JSON from '{0}'".format(response.content)) # lint-amnesty, pylint: disable=raise-missing-from
# Configure the XBlock
response = self.session.post(

View File

@@ -13,14 +13,14 @@ class CertificateConfigFixtureError(Exception):
"""
Error occurred while installing certificate config fixture.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class CertificateConfigUpdateFixtureError(Exception):
"""
Error occurred while updating certificate config fixture.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class CertificateConfigFixture(StudioApiFixture):
@@ -32,7 +32,7 @@ class CertificateConfigFixture(StudioApiFixture):
def __init__(self, course_id, certificates_data):
self.course_id = course_id
self.certificates = certificates_data
super(CertificateConfigFixture, self).__init__()
super(CertificateConfigFixture, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
def install(self):
"""

View File

@@ -17,7 +17,7 @@ class ConfigModelFixtureError(Exception):
"""
Error occurred while configuring the stub XQueue.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class ConfigModelFixture(object):
@@ -62,7 +62,7 @@ class ConfigModelFixture(object):
Log in as a staff user, then return the cookies for the session (as a dict)
Raises a `ConfigModelFixtureError` if the login fails.
"""
return {key: val for key, val in self.session.cookies.items()}
return {key: val for key, val in self.session.cookies.items()} # lint-amnesty, pylint: disable=unnecessary-comprehension
@lazy
def headers(self):

View File

@@ -120,7 +120,7 @@ class CourseFixture(XBlockContainerFixture):
to enable entrance exam settings would be a dict like this {"entrance_exam_enabled": "true"}
These have the same meaning as in the Studio restful API /course end-point.
"""
super(CourseFixture, self).__init__()
super(CourseFixture, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self._course_dict = {
'org': org,
'number': number,
@@ -242,7 +242,7 @@ class CourseFixture(XBlockContainerFixture):
try:
course_outline_json = response.json()
except ValueError:
raise FixtureError(
raise FixtureError( # lint-amnesty, pylint: disable=raise-missing-from
u"Could not decode course outline as JSON: '{0}'".format(response)
)
return course_outline_json
@@ -290,7 +290,7 @@ class CourseFixture(XBlockContainerFixture):
err = response.json().get('ErrMsg')
except ValueError:
raise FixtureError(
raise FixtureError( # lint-amnesty, pylint: disable=raise-missing-from
u"Could not parse response from course request as JSON: '{0}'".format(
response.content))
@@ -322,7 +322,7 @@ class CourseFixture(XBlockContainerFixture):
try:
details = response.json()
except ValueError:
raise FixtureError(
raise FixtureError( # lint-amnesty, pylint: disable=raise-missing-from
u"Could not decode course details as JSON: '{0}'".format(details)
)
@@ -397,7 +397,7 @@ class CourseFixture(XBlockContainerFixture):
for asset_name in self._assets:
asset_file_path = test_dir + '/data/uploads/' + asset_name
asset_file = open(asset_file_path, mode='rb') # pylint: disable=open-builtin
asset_file = open(asset_file_path, mode='rb') # lint-amnesty, pylint: disable=bad-option-value, open-builtin
files = {'file': (asset_name, asset_file, mimetypes.guess_type(asset_file_path)[0])}
headers = {
@@ -447,5 +447,5 @@ class CourseFixture(XBlockContainerFixture):
"""
Recursively create XBlock children.
"""
super(CourseFixture, self)._create_xblock_children(parent_loc, xblock_descriptions)
super(CourseFixture, self)._create_xblock_children(parent_loc, xblock_descriptions) # lint-amnesty, pylint: disable=super-with-arguments
self._publish_xblock(parent_loc)

View File

@@ -13,7 +13,7 @@ from common.test.acceptance.fixtures import COMMENTS_STUB_URL
from common.test.acceptance.fixtures.config import ConfigModelFixture
class ContentFactory(factory.Factory):
class ContentFactory(factory.Factory): # lint-amnesty, pylint: disable=missing-class-docstring
class Meta(object):
model = dict
@@ -40,7 +40,7 @@ class ContentFactory(factory.Factory):
return kwargs
class Thread(ContentFactory):
class Thread(ContentFactory): # lint-amnesty, pylint: disable=missing-class-docstring
thread_type = "discussion"
anonymous = False
anonymous_to_peers = False
@@ -67,7 +67,7 @@ class Response(Comment):
body = "dummy response body"
class SearchResult(factory.Factory):
class SearchResult(factory.Factory): # lint-amnesty, pylint: disable=missing-class-docstring
class Meta(object):
model = dict
@@ -78,7 +78,7 @@ class SearchResult(factory.Factory):
corrected_text = None
class DiscussionContentFixture(object):
class DiscussionContentFixture(object): # lint-amnesty, pylint: disable=missing-class-docstring
def push(self):
"""
@@ -96,12 +96,12 @@ class DiscussionContentFixture(object):
raise NotImplementedError()
class SingleThreadViewFixture(DiscussionContentFixture):
class SingleThreadViewFixture(DiscussionContentFixture): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, thread):
self.thread = thread
def addResponse(self, response, comments=[]):
def addResponse(self, response, comments=[]): # lint-amnesty, pylint: disable=dangerous-default-value, missing-function-docstring
response['children'] = comments
if self.thread["thread_type"] == "discussion":
responseListAttr = "children"
@@ -133,7 +133,7 @@ class SingleThreadViewFixture(DiscussionContentFixture):
}
class MultipleThreadFixture(DiscussionContentFixture):
class MultipleThreadFixture(DiscussionContentFixture): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, threads):
self.threads = threads
@@ -157,7 +157,7 @@ class MultipleThreadFixture(DiscussionContentFixture):
thread['comments_count'] += len(comments) + 1
class UserProfileViewFixture(DiscussionContentFixture):
class UserProfileViewFixture(DiscussionContentFixture): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, threads):
self.threads = threads
@@ -166,7 +166,7 @@ class UserProfileViewFixture(DiscussionContentFixture):
return {"active_threads": json.dumps(self.threads)}
class SearchResultFixture(DiscussionContentFixture):
class SearchResultFixture(DiscussionContentFixture): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, result):
self.result = result

View File

@@ -22,7 +22,7 @@ class LibraryFixture(XBlockContainerFixture):
"""
Configure the library fixture to create a library with
"""
super(LibraryFixture, self).__init__()
super(LibraryFixture, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.library_info = {
'org': org,
'number': number,
@@ -31,7 +31,7 @@ class LibraryFixture(XBlockContainerFixture):
self.display_name = display_name
self._library_key = None
super(LibraryFixture, self).__init__()
super(LibraryFixture, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
def __str__(self):
"""
@@ -92,4 +92,4 @@ class LibraryFixture(XBlockContainerFixture):
# Disable publishing for library XBlocks:
xblock_desc.publish = "not-applicable"
return super(LibraryFixture, self).create_xblock(parent_loc, xblock_desc)
return super(LibraryFixture, self).create_xblock(parent_loc, xblock_desc) # lint-amnesty, pylint: disable=super-with-arguments

View File

@@ -45,7 +45,7 @@ class AutoAuthPage(PageObject):
Note that "global staff" is NOT the same as course staff.
"""
super(AutoAuthPage, self).__init__(browser)
super(AutoAuthPage, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
# This will eventually hold the details about the user account
self._user_info = None

View File

@@ -43,4 +43,4 @@ def confirm_prompt(page, cancel=False, require_notification=None):
confirmation_button_css = '.prompt .action-' + ('secondary' if cancel else 'primary')
page.wait_for_element_visibility(confirmation_button_css, 'Confirmation button is visible')
require_notification = (not cancel) if require_notification is None else require_notification
click_css(page, confirmation_button_css, require_notification=require_notification)
click_css(page, confirmation_button_css, require_notification=require_notification) # lint-amnesty, pylint: disable=unexpected-keyword-arg

View File

@@ -24,4 +24,4 @@ class CacheProgramsPage(PageObject):
body = self.q(css='body').text[0]
match = re.search(r'programs cached', body, flags=re.IGNORECASE)
return True if match else False
return True if match else False # lint-amnesty, pylint: disable=simplifiable-if-expression

View File

@@ -20,7 +20,7 @@ class CourseHomePage(CoursePage):
return self.q(css='.course-outline').present
def __init__(self, browser, course_id):
super(CourseHomePage, self).__init__(browser, course_id)
super(CourseHomePage, self).__init__(browser, course_id) # lint-amnesty, pylint: disable=super-with-arguments
self.course_id = course_id
self.preview = StaffPreviewPage(browser, self)
# TODO: TNL-6546: Remove the following

View File

@@ -9,7 +9,7 @@ from common.test.acceptance.pages.lms import BASE_URL
from common.test.acceptance.pages.lms.tab_nav import TabNavPage
class CoursePage(PageObject):
class CoursePage(PageObject): # lint-amnesty, pylint: disable=abstract-method
"""
Abstract base class for page objects within a course.
"""
@@ -23,7 +23,7 @@ class CoursePage(PageObject):
Course ID is currently of the form "edx/999/2013_Spring"
but this format could change.
"""
super(CoursePage, self).__init__(browser)
super(CoursePage, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
self.course_id = course_id
@property

View File

@@ -57,7 +57,7 @@ class CourseWikiSubviewPage(CoursePage): # pylint: disable=abstract-method
Course ID is currently of the form "edx/999/2013_Spring"
but this format could change.
"""
super(CourseWikiSubviewPage, self).__init__(browser, course_id)
super(CourseWikiSubviewPage, self).__init__(browser, course_id) # lint-amnesty, pylint: disable=super-with-arguments
self.course_id = course_id
self.course_info = course_info
self.article_name = "{org}.{course_number}.{course_run}".format(

View File

@@ -20,8 +20,8 @@ class CoursewarePage(CoursePage):
section_selector = '.chapter'
subsection_selector = '.chapter-content-container a'
def __init__(self, browser, course_id):
super(CoursewarePage, self).__init__(browser, course_id)
def __init__(self, browser, course_id): # lint-amnesty, pylint: disable=useless-super-delegation
super(CoursewarePage, self).__init__(browser, course_id) # lint-amnesty, pylint: disable=super-with-arguments
# self.nav = CourseNavPage(browser, self)
def is_browser_on_page(self):

View File

@@ -18,7 +18,7 @@ class DiscussionThreadPage(PageObject):
url = None
def __init__(self, browser, thread_selector):
super(DiscussionThreadPage, self).__init__(browser)
super(DiscussionThreadPage, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
self.thread_selector = thread_selector
def _find_within(self, selector):
@@ -74,9 +74,9 @@ class DiscussionThreadPage(PageObject):
).fulfill()
class DiscussionTabSingleThreadPage(CoursePage):
class DiscussionTabSingleThreadPage(CoursePage): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, browser, course_id, discussion_id, thread_id):
super(DiscussionTabSingleThreadPage, self).__init__(browser, course_id)
super(DiscussionTabSingleThreadPage, self).__init__(browser, course_id) # lint-amnesty, pylint: disable=super-with-arguments
self.thread_page = DiscussionThreadPage(
browser,
u"body.discussion .discussion-article[data-id='{thread_id}']".format(thread_id=thread_id)
@@ -103,7 +103,7 @@ class DiscussionTabHomePage(CoursePage):
ALERT_SELECTOR = ".discussion-body .forum-nav .search-alert"
def __init__(self, browser, course_id):
super(DiscussionTabHomePage, self).__init__(browser, course_id)
super(DiscussionTabHomePage, self).__init__(browser, course_id) # lint-amnesty, pylint: disable=super-with-arguments
self.url_path = "discussion/forum/"
self.root_selector = None

View File

@@ -245,7 +245,7 @@ class FieldsMixin(object):
Returns bool based on the highlighted border for field.
"""
query = self.q(css=u'.u-field-{}.error'.format(field_id))
return True if query.present else False
return True if query.present else False # lint-amnesty, pylint: disable=simplifiable-if-expression
def get_social_first_element(self):
"""

View File

@@ -25,7 +25,7 @@ class Badge(PageObject):
def __init__(self, element, browser):
self.element = element
super(Badge, self).__init__(browser)
super(Badge, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
def is_browser_on_page(self):
return BrowserQuery(self.element, css=".badge-details").visible
@@ -84,7 +84,7 @@ class LearnerProfilePage(FieldsMixin, PageObject):
browser (Browser): The browser instance.
username (str): Profile username.
"""
super(LearnerProfilePage, self).__init__(browser)
super(LearnerProfilePage, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
self.username = username
@property

View File

@@ -28,7 +28,7 @@ class StaffPreviewPage(PageObject):
parent_page: None if this is being used as a subclass. Otherwise,
the parent_page the contains this staff preview page fragment.
"""
super(StaffPreviewPage, self).__init__(browser)
super(StaffPreviewPage, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
self.parent_page = parent_page
def is_browser_on_page(self):

View File

@@ -7,7 +7,7 @@ import logging
from bok_choy.javascript import js_defined, wait_for_js
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise, Promise
from bok_choy.promise import EmptyPromise, Promise # lint-amnesty, pylint: disable=unused-import
log = logging.getLogger('VideoPage')
@@ -220,7 +220,7 @@ class VideoPage(PageObject):
# toggle captions visibility state if needed
if self.is_captions_visible() != captions_new_state:
self.click_player_button('transcript_button')
self.click_player_button('transcript_button') # lint-amnesty, pylint: disable=no-member
# Verify that captions state is toggled/changed
EmptyPromise(lambda: self.is_captions_visible() == captions_new_state,

View File

@@ -22,7 +22,7 @@ class ContainerPage(PageObject, HelpMixin):
ADD_MISSING_GROUPS_SELECTOR = '.notification-action-button[data-notification-action="add-missing-groups"]'
def __init__(self, browser, locator):
super(ContainerPage, self).__init__(browser)
super(ContainerPage, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
self.locator = locator
@property
@@ -31,7 +31,7 @@ class ContainerPage(PageObject, HelpMixin):
return u"{}/container/{}".format(BASE_URL, self.locator)
@property
def name(self):
def name(self): # lint-amnesty, pylint: disable=missing-function-docstring
titles = self.q(css=self.NAME_SELECTOR).text
if titles:
return titles[0]
@@ -51,7 +51,7 @@ class ContainerPage(PageObject, HelpMixin):
if len(data_request_elements) > 0:
request_token = data_request_elements.first.attrs('data-request-token')[0]
# Then find the number of Studio xblock wrappers on the page with that request token.
num_wrappers = len(self.q(css=u'{} [data-request-token="{}"]'.format(XBlockWrapper.BODY_SELECTOR, request_token)).results)
num_wrappers = len(self.q(css=u'{} [data-request-token="{}"]'.format(XBlockWrapper.BODY_SELECTOR, request_token)).results) # lint-amnesty, pylint: disable=line-too-long
# Wait until all components have been loaded and marked as either initialized or failed.
# See:
# - common/static/js/xblock/core.js which adds the class "xblock-initialized"
@@ -159,9 +159,9 @@ class ContainerPage(PageObject, HelpMixin):
if not warnings.is_present():
return False
warning_text = warnings.first.text[0]
return warning_text == "Caution: The last published version of this unit is live. By publishing changes you will change the student experience."
return warning_text == "Caution: The last published version of this unit is live. By publishing changes you will change the student experience." # lint-amnesty, pylint: disable=line-too-long
def shows_inherited_staff_lock(self, parent_type=None, parent_name=None):
def shows_inherited_staff_lock(self, parent_type=None, parent_name=None): # lint-amnesty, pylint: disable=unused-argument
"""
Returns True if the unit inherits staff lock from a section or subsection.
"""
@@ -187,14 +187,14 @@ class ContainerPage(PageObject, HelpMixin):
Publishes the container.
"""
self.scroll_to_element('.action-publish')
click_css(self, '.action-publish', 0, require_notification=False)
click_css(self, '.action-publish', 0, require_notification=False) # lint-amnesty, pylint: disable=unexpected-keyword-arg
def discard_changes(self):
"""
Discards draft changes (which will then re-render the page).
"""
self.scroll_to_element('a.action-discard')
click_css(self, 'a.action-discard', 0, require_notification=False)
click_css(self, 'a.action-discard', 0, require_notification=False) # lint-amnesty, pylint: disable=unexpected-keyword-arg
confirm_prompt(self)
self.wait_for_ajax()
@@ -237,7 +237,7 @@ class ContainerPage(PageObject, HelpMixin):
if not was_locked_initially:
self.q(css='a.action-staff-lock').first.click()
else:
click_css(self, 'a.action-staff-lock', 0, require_notification=False)
click_css(self, 'a.action-staff-lock', 0, require_notification=False) # lint-amnesty, pylint: disable=unexpected-keyword-arg
if not inherits_staff_lock:
confirm_prompt(self)
self.wait_for_ajax()
@@ -299,7 +299,7 @@ class ContainerPage(PageObject, HelpMixin):
The index of the first item is 0.
"""
# Click the delete button
click_css(self, '.delete-button', source_index, require_notification=False)
click_css(self, '.delete-button', source_index, require_notification=False) # lint-amnesty, pylint: disable=unexpected-keyword-arg
# Click the confirmation dialog button
confirm_prompt(self)
@@ -338,7 +338,7 @@ class ContainerPage(PageObject, HelpMixin):
"""
Click take me there link.
"""
click_css(self, '#page-alert .alert.confirmation .nav-actions .action-secondary', require_notification=False)
click_css(self, '#page-alert .alert.confirmation .nav-actions .action-secondary', require_notification=False) # lint-amnesty, pylint: disable=unexpected-keyword-arg
def add_missing_groups(self):
"""
@@ -433,7 +433,7 @@ class XBlockWrapper(PageObject):
}
def __init__(self, browser, locator):
super(XBlockWrapper, self).__init__(browser)
super(XBlockWrapper, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
self.locator = locator
def is_browser_on_page(self):
@@ -465,7 +465,7 @@ class XBlockWrapper(PageObject):
return self.q(css=self._bounded_selector('.xblock-author_view'))[0].text
@property
def name(self):
def name(self): # lint-amnesty, pylint: disable=missing-function-docstring
titles = self.q(css=self._bounded_selector(self.NAME_SELECTOR)).text
if titles:
return titles[0]
@@ -618,7 +618,7 @@ class XBlockWrapper(PageObject):
"""
Opens the move modal.
"""
click_css(self, '.move-button', require_notification=False)
click_css(self, '.move-button', require_notification=False) # lint-amnesty, pylint: disable=unexpected-keyword-arg
self.wait_for(
lambda: self.q(css='.modal-window.move-modal').visible, description='move modal is visible'
)

View File

@@ -30,7 +30,7 @@ class CoursePage(PageObject, HelpMixin):
Should be implemented in child classes.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
def __init__(self, browser, course_org, course_num, course_run):
"""
@@ -39,7 +39,7 @@ class CoursePage(PageObject, HelpMixin):
These identifiers will likely change in the future.
"""
super(CoursePage, self).__init__(browser)
super(CoursePage, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
self.course_info = {
'course_org': course_org,
'course_num': course_num,

View File

@@ -18,7 +18,7 @@ class LibraryPage(PageObject, HelpMixin):
Base page for Library pages. Defaults URL to the edit page.
"""
def __init__(self, browser, locator):
super(LibraryPage, self).__init__(browser)
super(LibraryPage, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
self.locator = locator
@property
@@ -50,4 +50,4 @@ class LibraryEditPage(LibraryPage, PaginatedMixin, UsersPageMixin):
for improved test reliability.
"""
self.wait_for_ajax()
super(LibraryEditPage, self).wait_until_ready()
super(LibraryEditPage, self).wait_until_ready() # lint-amnesty, pylint: disable=super-with-arguments

View File

@@ -3,7 +3,7 @@ Course Outline page in Studio.
"""
from bok_choy.javascript import js_defined, wait_for_js
from bok_choy.javascript import js_defined, wait_for_js # lint-amnesty, pylint: disable=unused-import
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
from selenium.webdriver.support.ui import Select
@@ -58,7 +58,7 @@ class CourseOutlineItem(object):
Puts the item into editable form.
"""
self.q(css=self._bounded_selector(self.CONFIGURATION_BUTTON_SELECTOR)).first.click() # pylint: disable=no-member
if 'subsection' in self.BODY_SELECTOR:
if 'subsection' in self.BODY_SELECTOR: # lint-amnesty, pylint: disable=unsupported-membership-test
modal = SubsectionOutlineModal(self)
else:
modal = CourseOutlineModal(self)
@@ -105,7 +105,7 @@ class CourseOutlineChild(PageObject, CourseOutlineItem):
BODY_SELECTOR = '.outline-item'
def __init__(self, browser, locator):
super(CourseOutlineChild, self).__init__(browser)
super(CourseOutlineChild, self).__init__(browser) # lint-amnesty, pylint: disable=super-with-arguments
self.locator = locator
def is_browser_on_page(self):
@@ -160,7 +160,7 @@ class CourseOutlineSubsection(CourseOutlineContainer, CourseOutlineChild):
"""
Return the :class:`.CourseOutlineUnit with the title `title`.
"""
return self.child(title)
return self.child(title) # lint-amnesty, pylint: disable=no-member
def units(self):
"""
@@ -195,7 +195,7 @@ class CourseOutlineSection(CourseOutlineContainer, CourseOutlineChild):
"""
Return the :class:`.CourseOutlineSubsection` with the title `title`.
"""
return self.child(title)
return self.child(title) # lint-amnesty, pylint: disable=no-member
def subsections(self):
"""
@@ -213,7 +213,7 @@ class CourseOutlineSection(CourseOutlineContainer, CourseOutlineChild):
"""
Adds a subsection to this section
"""
self.add_child()
self.add_child() # lint-amnesty, pylint: disable=no-member
class ExpandCollapseLinkState(object):
@@ -251,7 +251,7 @@ class CourseOutlinePage(CoursePage, CourseOutlineContainer):
"""
Starts course reindex by clicking reindex button
"""
self.reindex_button.click()
self.reindex_button.click() # lint-amnesty, pylint: disable=no-member
def open_subsection_settings_dialog(self, index=0):
"""
@@ -363,7 +363,7 @@ class SubsectionOutlineModal(CourseOutlineModal):
"""
Returns the current visibility setting for a subsection
"""
self.ensure_staff_lock_visible()
self.ensure_staff_lock_visible() # lint-amnesty, pylint: disable=no-member
return self.find_css('input[name=content-visibility]:checked').first.attrs('value')[0]
@is_explicitly_locked.setter
@@ -380,7 +380,7 @@ class SubsectionOutlineModal(CourseOutlineModal):
"""
Sets the subsection visibility to the given value.
"""
self.ensure_staff_lock_visible()
self.ensure_staff_lock_visible() # lint-amnesty, pylint: disable=no-member
self.find_css('input[name=content-visibility][value=' + value + ']').click()
EmptyPromise(lambda: value == self.subsection_visibility, "Subsection visibility is updated").fulfill()

View File

@@ -25,7 +25,7 @@ class UsersPageMixin(PageObject):
""" Common functionality for course/library team pages """
new_user_form_selector = '.form-create.create-user .user-email-input'
def url(self):
def url(self): # lint-amnesty, pylint: disable=invalid-overridden-method
"""
URL to this page - override in subclass
"""

View File

@@ -15,7 +15,7 @@ SIDE_BAR_HELP_CSS = '.external-help a, .external-help-button'
@js_defined('window.jQuery')
def type_in_codemirror(page, index, text, find_prefix="$"):
def type_in_codemirror(page, index, text, find_prefix="$"): # lint-amnesty, pylint: disable=missing-function-docstring
script = u"""
var cm = {find_prefix}('div.CodeMirror:eq({index})').get(0).CodeMirror;
CodeMirror.signal(cm, "focus", cm);
@@ -71,7 +71,7 @@ def verify_ordering(test_class, page, expected_orderings):
expected_length = len(expected_ordering.get(parent))
test_class.assertEqual(
expected_length, len(children),
u"Number of children incorrect for group {0}. Expected {1} but got {2}.".format(parent, expected_length, len(children)))
u"Number of children incorrect for group {0}. Expected {1} but got {2}.".format(parent, expected_length, len(children))) # lint-amnesty, pylint: disable=line-too-long
for idx, expected in enumerate(expected_ordering.get(parent)):
test_class.assertEqual(expected, children[idx].name)
blocks_checked.add(expected)

View File

@@ -14,7 +14,7 @@ from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from six.moves import range
from common.test.acceptance.pages.common.utils import sync_on_notification
from common.test.acceptance.pages.common.utils import sync_on_notification # lint-amnesty, pylint: disable=no-name-in-module
from common.test.acceptance.pages.lms.video.video import VideoPage
from common.test.acceptance.tests.helpers import YouTubeStubConfig
@@ -113,7 +113,7 @@ class VideoComponentPage(VideoPage):
)
def get_element_selector(self, class_name, vertical=False):
return super(VideoComponentPage, self).get_element_selector(class_name, vertical=vertical)
return super(VideoComponentPage, self).get_element_selector(class_name, vertical=vertical) # lint-amnesty, pylint: disable=super-with-arguments
def _wait_for(self, check_func, desc, result=False, timeout=30):
"""
@@ -549,7 +549,7 @@ class VideoComponentPage(VideoPage):
mime_type = 'application/x-subrip'
lang_code = '?language_code={}'.format(language_code)
link = [link for link in self.q(css='.download-action').attrs('href') if lang_code in link]
result, headers, content = self._get_transcript(link[0])
result, headers, content = self._get_transcript(link[0]) # lint-amnesty, pylint: disable=no-member
return result is True and mime_type in headers['content-type'] and text_to_search in content.decode('utf-8')
@@ -578,7 +578,7 @@ class VideoComponentPage(VideoPage):
As all the captions lines are exactly same so only getting partial lines will work.
"""
self.wait_for_captions()
self.wait_for_captions() # lint-amnesty, pylint: disable=no-member
selector = u'.subtitles li:nth-child({})'
return ' '.join([self.q(css=selector.format(i)).text[0] for i in range(1, 6)])

View File

@@ -51,7 +51,7 @@ class CohortTestMixin(object):
Sets up the course to use cohorting with the given list of auto_cohort_groups.
If auto_cohort_groups is None, no auto cohorts are set.
"""
course_fixture._update_xblock(course_fixture._course_location, {
course_fixture._update_xblock(course_fixture._course_location, { # lint-amnesty, pylint: disable=protected-access
"metadata": {
u"cohort_config": {
"auto_cohort_groups": auto_cohort_groups or [],
@@ -65,7 +65,7 @@ class CohortTestMixin(object):
"""
Adds a cohort by name, returning its ID.
"""
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/'
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + '/cohorts/' # lint-amnesty, pylint: disable=protected-access
data = json.dumps({"name": cohort_name, 'assignment_type': 'manual'})
response = course_fixture.session.post(url, data=data, headers=course_fixture.headers)
self.assertTrue(response.ok, "Failed to create cohort")
@@ -75,7 +75,7 @@ class CohortTestMixin(object):
"""
Adds a user to the specified cohort.
"""
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + "/cohorts/{}/add".format(cohort_id)
url = LMS_BASE_URL + "/courses/" + course_fixture._course_key + "/cohorts/{}/add".format(cohort_id) # lint-amnesty, pylint: disable=protected-access
data = {"users": username}
course_fixture.headers['Content-type'] = 'application/x-www-form-urlencoded'
response = course_fixture.session.post(url, data=data, headers=course_fixture.headers)
@@ -85,7 +85,7 @@ class CohortTestMixin(object):
class BaseDiscussionTestCase(UniqueCourseTest, ForumsConfigMixin):
"""Base test case class for all discussions-related tests."""
def setUp(self):
super(BaseDiscussionTestCase, self).setUp()
super(BaseDiscussionTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.discussion_id = "test_discussion_{}".format(uuid4().hex)
self.course_fixture = CourseFixture(**self.course_info)

View File

@@ -24,7 +24,7 @@ class CohortConfigurationTest(EventsTestMixin, UniqueCourseTest, CohortTestMixin
"""
Set up a cohorted course
"""
super(CohortConfigurationTest, self).setUp()
super(CohortConfigurationTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# create course with cohorts
self.manual_cohort_name = "ManualCohort1"

View File

@@ -7,7 +7,7 @@ from uuid import uuid4
import pytest
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc # lint-amnesty, pylint: disable=unused-import
from common.test.acceptance.fixtures.discussion import (
Comment,
Response,
@@ -23,7 +23,7 @@ from common.test.acceptance.tests.discussion.helpers import BaseDiscussionMixin,
from common.test.acceptance.tests.helpers import UniqueCourseTest
from openedx.core.lib.tests import attr
THREAD_CONTENT_WITH_LATEX = u"""Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
THREAD_CONTENT_WITH_LATEX = u"""Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt # lint-amnesty, pylint: disable=line-too-long
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit sse cillum dolore eu fugiat nulla pariatur.
@@ -94,7 +94,7 @@ class DiscussionHomePageTest(BaseDiscussionTestCase):
SEARCHED_USERNAME = "gizmo"
def setUp(self):
super(DiscussionHomePageTest, self).setUp()
super(DiscussionHomePageTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
AutoAuthPage(self.browser, course_id=self.course_id).visit()
self.page = DiscussionTabHomePage(self.browser, self.course_id)
self.page.visit()
@@ -117,7 +117,7 @@ class DiscussionTabMultipleThreadTest(BaseDiscussionTestCase, BaseDiscussionMixi
Tests for the discussion page with multiple threads
"""
def setUp(self):
super(DiscussionTabMultipleThreadTest, self).setUp()
super(DiscussionTabMultipleThreadTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
AutoAuthPage(self.browser, course_id=self.course_id).visit()
self.thread_count = 2
self.thread_ids = []
@@ -167,15 +167,15 @@ class DiscussionOpenClosedThreadTest(BaseDiscussionTestCase):
"""
def setUp(self):
super(DiscussionOpenClosedThreadTest, self).setUp()
super(DiscussionOpenClosedThreadTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.thread_id = "test_thread_{}".format(uuid4().hex)
def setup_user(self, roles=[]):
def setup_user(self, roles=[]): # lint-amnesty, pylint: disable=dangerous-default-value
roles_str = ','.join(roles)
self.user_id = AutoAuthPage(self.browser, course_id=self.course_id, roles=roles_str).visit().get_user_id()
self.user_id = AutoAuthPage(self.browser, course_id=self.course_id, roles=roles_str).visit().get_user_id() # lint-amnesty, pylint: disable=attribute-defined-outside-init
def setup_view(self, **thread_kwargs):
def setup_view(self, **thread_kwargs): # lint-amnesty, pylint: disable=missing-function-docstring
thread_kwargs.update({'commentable_id': self.discussion_id})
view = SingleThreadViewFixture(
Thread(id=self.thread_id, **thread_kwargs)
@@ -183,7 +183,7 @@ class DiscussionOpenClosedThreadTest(BaseDiscussionTestCase):
view.addResponse(Response(id="response1"))
view.push()
def setup_openclosed_thread_page(self, closed=False):
def setup_openclosed_thread_page(self, closed=False): # lint-amnesty, pylint: disable=missing-function-docstring
self.setup_user(roles=['Moderator'])
if closed:
self.setup_view(closed=True)
@@ -225,11 +225,11 @@ class DiscussionResponseEditTest(BaseDiscussionTestCase):
"""
Tests for editing responses displayed beneath thread in the single thread view.
"""
def setup_user(self, roles=[]):
def setup_user(self, roles=[]): # lint-amnesty, pylint: disable=dangerous-default-value
roles_str = ','.join(roles)
self.user_id = AutoAuthPage(self.browser, course_id=self.course_id, roles=roles_str).visit().get_user_id()
self.user_id = AutoAuthPage(self.browser, course_id=self.course_id, roles=roles_str).visit().get_user_id() # lint-amnesty, pylint: disable=attribute-defined-outside-init
def setup_view(self):
def setup_view(self): # lint-amnesty, pylint: disable=missing-function-docstring
view = SingleThreadViewFixture(Thread(id="response_edit_test_thread", commentable_id=self.discussion_id))
view.addResponse(
Response(id="response_other_author", user_id="other", thread_id="response_edit_test_thread"),
@@ -260,15 +260,15 @@ class DiscussionCommentEditTest(BaseDiscussionTestCase):
"""
Tests for editing comments displayed beneath responses in the single thread view.
"""
def setup_user(self, roles=[]):
def setup_user(self, roles=[]): # lint-amnesty, pylint: disable=dangerous-default-value
roles_str = ','.join(roles)
self.user_id = AutoAuthPage(self.browser, course_id=self.course_id, roles=roles_str).visit().get_user_id()
self.user_id = AutoAuthPage(self.browser, course_id=self.course_id, roles=roles_str).visit().get_user_id() # lint-amnesty, pylint: disable=attribute-defined-outside-init
def setup_view(self):
def setup_view(self): # lint-amnesty, pylint: disable=missing-function-docstring
view = SingleThreadViewFixture(Thread(id="comment_edit_test_thread", commentable_id=self.discussion_id))
view.addResponse(
Response(id="response1"),
[Comment(id="comment_other_author", user_id="other"), Comment(id="comment_self_author", user_id=self.user_id)])
[Comment(id="comment_other_author", user_id="other"), Comment(id="comment_self_author", user_id=self.user_id)]) # lint-amnesty, pylint: disable=line-too-long
view.push()
@attr('a11y')
@@ -321,7 +321,7 @@ class DiscussionSearchAlertTest(UniqueCourseTest):
SEARCHED_USERNAME = "gizmo"
def setUp(self):
super(DiscussionSearchAlertTest, self).setUp()
super(DiscussionSearchAlertTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
CourseFixture(**self.course_info).install()
# first auto auth call sets up a user that we will search for in some tests
self.searched_user_id = AutoAuthPage(

View File

@@ -19,12 +19,12 @@ from bok_choy.promise import EmptyPromise, Promise
from bok_choy.web_app_test import WebAppTest
from opaque_keys.edx.locator import CourseLocator
from path import Path as path
from pymongo import ASCENDING, MongoClient
from pymongo import ASCENDING, MongoClient # lint-amnesty, pylint: disable=unused-import
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.ui import WebDriverWait
from six.moves import range, zip
from six.moves import range, zip # lint-amnesty, pylint: disable=unused-import
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
@@ -342,7 +342,7 @@ class EventsTestMixin(TestCase):
Helpers and setup for running tests that evaluate events emitted
"""
def setUp(self):
super(EventsTestMixin, self).setUp()
super(EventsTestMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
mongo_host = 'edx.devstack.mongo' if 'BOK_CHOY_HOSTNAME' in os.environ else 'localhost'
self.event_collection = MongoClient(mongo_host)["test"]["events"]
self.start_time = datetime.now()
@@ -354,14 +354,14 @@ class AcceptanceTest(WebAppTest):
"""
def __init__(self, *args, **kwargs):
super(AcceptanceTest, self).__init__(*args, **kwargs)
super(AcceptanceTest, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
# Use long messages so that failures show actual and expected values
self.longMessage = True # pylint: disable=invalid-name
def tearDown(self):
self._save_console_log()
super(AcceptanceTest, self).tearDown()
super(AcceptanceTest, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
def _save_console_log(self):
"""
@@ -411,7 +411,7 @@ class UniqueCourseTest(AcceptanceTest):
"""
def setUp(self):
super(UniqueCourseTest, self).setUp()
super(UniqueCourseTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course_info = {
'org': 'test_org',
@@ -440,7 +440,7 @@ class YouTubeConfigError(Exception):
"""
Error occurred while configuring YouTube Stub Server.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class YouTubeStubConfig(object):

View File

@@ -30,7 +30,7 @@ class CourseWikiA11yTest(UniqueCourseTest):
"""
Initialize pages and install a course fixture.
"""
super(CourseWikiA11yTest, self).setUp()
super(CourseWikiA11yTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# self.course_info['number'] must be shorter since we are accessing the wiki. See TNL-1751
self.course_info['number'] = self.unique_id[0:6]

View File

@@ -22,7 +22,7 @@ class CourseHomeBaseTest(UniqueCourseTest):
"""
Initialize pages and install a course fixture.
"""
super(CourseHomeBaseTest, self).setUp()
super(CourseHomeBaseTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course_home_page = CourseHomePage(self.browser, self.course_id)
self.courseware_page = CoursewarePage(self.browser, self.course_id)

View File

@@ -23,7 +23,7 @@ class BaseLmsDashboardTestMultiple(UniqueCourseTest):
"""
# Some parameters are provided by the parent setUp() routine, such as the following:
# self.course_id, self.course_info, self.unique_id
super(BaseLmsDashboardTestMultiple, self).setUp()
super(BaseLmsDashboardTestMultiple, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# Load page objects for use by the tests
self.dashboard_page = DashboardPage(self.browser)

View File

@@ -59,7 +59,7 @@ class LMSInstructorDashboardA11yTest(BaseInstructorDashboardTest):
Instructor dashboard base accessibility test.
"""
def setUp(self):
super(LMSInstructorDashboardA11yTest, self).setUp()
super(LMSInstructorDashboardA11yTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course_fixture = CourseFixture(**self.course_info).install()
self.log_in_as_instructor()
self.instructor_dashboard_page = self.visit_instructor_dashboard()
@@ -82,7 +82,7 @@ class BulkEmailTest(BaseInstructorDashboardTest):
shard = 23
def setUp(self):
super(BulkEmailTest, self).setUp()
super(BulkEmailTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course_fixture = CourseFixture(**self.course_info).install()
self.log_in_as_instructor()
instructor_dashboard_page = self.visit_instructor_dashboard()
@@ -114,7 +114,7 @@ class AutoEnrollmentWithCSVTest(BaseInstructorDashboardTest):
"""
def setUp(self):
super(AutoEnrollmentWithCSVTest, self).setUp()
super(AutoEnrollmentWithCSVTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course_fixture = CourseFixture(**self.course_info).install()
self.log_in_as_instructor()
instructor_dashboard_page = self.visit_instructor_dashboard()
@@ -141,7 +141,7 @@ class CertificatesTest(BaseInstructorDashboardTest):
"""
def setUp(self):
super(CertificatesTest, self).setUp()
super(CertificatesTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.test_certificate_config = {
'id': 1,
'name': 'Certificate name',
@@ -194,7 +194,7 @@ class CertificateInvalidationTest(BaseInstructorDashboardTest):
).install()
def setUp(self):
super(CertificateInvalidationTest, self).setUp()
super(CertificateInvalidationTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# set same course number as we have in fixture json
self.course_info['number'] = "335535897951379478207964576572017930000"

View File

@@ -20,7 +20,7 @@ class ProblemsTest(UniqueCourseTest):
"""
def setUp(self):
super(ProblemsTest, self).setUp()
super(ProblemsTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.username = "test_student_{uuid}".format(uuid=self.unique_id[0:8])
self.email = "{username}@example.com".format(username=self.username)

View File

@@ -24,7 +24,7 @@ class StaffViewTest(UniqueCourseTest):
EMAIL = "johndoe@example.com"
def setUp(self):
super(StaffViewTest, self).setUp()
super(StaffViewTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.courseware_page = CoursewarePage(self.browser, self.course_id)
@@ -60,7 +60,7 @@ class CourseWithContentGroupsTest(StaffViewTest):
"""
def setUp(self):
super(CourseWithContentGroupsTest, self).setUp()
super(CourseWithContentGroupsTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# pylint: disable=protected-access
self.course_fixture._update_xblock(self.course_fixture._course_location, {
"metadata": {
@@ -96,10 +96,10 @@ class CourseWithContentGroupsTest(StaffViewTest):
</problem>
""")
self.alpha_text = "VISIBLE TO ALPHA"
self.beta_text = "VISIBLE TO BETA"
self.audit_text = "VISIBLE TO AUDIT"
self.everyone_text = "VISIBLE TO EVERYONE"
self.alpha_text = "VISIBLE TO ALPHA" # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.beta_text = "VISIBLE TO BETA" # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.audit_text = "VISIBLE TO AUDIT" # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.everyone_text = "VISIBLE TO EVERYONE" # lint-amnesty, pylint: disable=attribute-defined-outside-init
course_fixture.add_children(
XBlockFixtureDesc('chapter', 'Test Section').add_children(

View File

@@ -57,7 +57,7 @@ class ProblemTypeTestBaseMeta(ABCMeta):
if obj.__getattribute__(required_attr) is None:
raise NotImplementedError(msg)
except AttributeError:
raise NotImplementedError(msg)
raise NotImplementedError(msg) # lint-amnesty, pylint: disable=raise-missing-from
return obj
@@ -96,7 +96,7 @@ class ProblemTypeTestBase(six.with_metaclass(ProblemTypeTestBaseMeta, ProblemsTe
"""
Visits courseware_page and defines self.problem_page.
"""
super(ProblemTypeTestBase, self).setUp()
super(ProblemTypeTestBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.courseware_page.visit()
self.problem_page = ProblemPage(self.browser)
@@ -215,7 +215,7 @@ class AnnotationProblemTypeBase(ProblemTypeTestBase):
"""
Additional setup for AnnotationProblemTypeBase
"""
super(AnnotationProblemTypeBase, self).setUp(*args, **kwargs)
super(AnnotationProblemTypeBase, self).setUp(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.problem_page.a11y_audit.config.set_rules({
"ignore": [
@@ -247,7 +247,7 @@ class AnnotationProblemTypeTest(AnnotationProblemTypeBase, ProblemTypeA11yTestMi
Standard tests for the Annotation Problem Type
"""
shard = 20
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class CheckboxProblemTypeBase(ProblemTypeTestBase):
@@ -445,7 +445,7 @@ class RadioProblemTypeTest(RadioProblemTypeBase, ProblemTypeA11yTestMixin):
Standard tests for the Multiple Radio Problem Type
"""
shard = 24
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class RadioProblemTypeTestNonRandomized(RadioProblemTypeBase, ProblemTypeA11yTestMixin):
@@ -500,7 +500,7 @@ class DropdownProblemTypeTest(DropDownProblemTypeBase, ProblemTypeA11yTestMixin)
Standard tests for the Dropdown Problem Type
"""
shard = 8
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
@ddt.ddt
@@ -569,7 +569,7 @@ class StringProblemTypeBase(ProblemTypeTestBase):
Answer string problem.
"""
textvalue = 'correct string' if correctness == 'correct' else 'incorrect string'
self.problem_page.fill_answer(textvalue)
self.problem_page.fill_answer(textvalue) # lint-amnesty, pylint: disable=no-member
class StringProblemTypeTest(StringProblemTypeBase, ProblemTypeA11yTestMixin):
@@ -577,7 +577,7 @@ class StringProblemTypeTest(StringProblemTypeBase, ProblemTypeA11yTestMixin):
Standard tests for the String Problem Type
"""
shard = 8
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class NumericalProblemTypeBase(ProblemTypeTestBase):
@@ -633,7 +633,7 @@ class NumericalProblemTypeBase(ProblemTypeTestBase):
textvalue = 'notNum'
else:
textvalue = str(random.randint(-2, 2))
self.problem_page.fill_answer(textvalue)
self.problem_page.fill_answer(textvalue) # lint-amnesty, pylint: disable=no-member
@ddt.ddt
@@ -713,7 +713,7 @@ class FormulaProblemTypeBase(ProblemTypeTestBase):
Answer formula problem.
"""
textvalue = "x^2+2*x+y" if correctness == 'correct' else 'x^2'
self.problem_page.fill_answer(textvalue)
self.problem_page.fill_answer(textvalue) # lint-amnesty, pylint: disable=no-member
@ddt.ddt
@@ -781,8 +781,8 @@ class ScriptProblemTypeBase(ProblemTypeTestBase):
if not correctness == 'correct':
second_addend += random.randint(1, 10)
self.problem_page.fill_answer(first_addend, input_num=0)
self.problem_page.fill_answer(second_addend, input_num=1)
self.problem_page.fill_answer(first_addend, input_num=0) # lint-amnesty, pylint: disable=no-member
self.problem_page.fill_answer(second_addend, input_num=1) # lint-amnesty, pylint: disable=no-member
@ddt.ddt
@@ -791,7 +791,7 @@ class ScriptProblemTypeTest(ScriptProblemTypeBase, ProblemTypeA11yTestMixin):
Standard tests for the Script Problem Type
"""
shard = 20
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class ScriptProblemTypeTestNonRandomized(ScriptProblemTypeBase, ProblemTypeA11yTestMixin):
@@ -871,7 +871,7 @@ class CodeProblemTypeBase(ProblemTypeTestBase):
# (there's not <textarea> we can just fill text into)
# For this reason, we submit the initial code in the response
# (configured in the problem XML above)
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class CodeProblemTypeTest(CodeProblemTypeBase, ProblemTypeA11yTestMixin):
@@ -885,7 +885,7 @@ class CodeProblemTypeTest(CodeProblemTypeBase, ProblemTypeA11yTestMixin):
Overridden for script test because the testing grader always responds
with "correct"
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class ChoiceTextProblemTypeTestBase(ProblemTypeTestBase):
@@ -974,7 +974,7 @@ class RadioTextProblemTypeBase(ChoiceTextProblemTypeTestBase):
"""
Additional setup for RadioTextProblemTypeBase
"""
super(RadioTextProblemTypeBase, self).setUp(*args, **kwargs)
super(RadioTextProblemTypeBase, self).setUp(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.problem_page.a11y_audit.config.set_rules({
"ignore": [
@@ -991,7 +991,7 @@ class RadioTextProblemTypeTest(RadioTextProblemTypeBase, ProblemTypeA11yTestMixi
Standard tests for the Radio Text Problem Type
"""
shard = 8
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class RadioTextProblemTypeTestNonRandomized(RadioTextProblemTypeBase, ProblemTypeA11yTestMixin):
@@ -1037,7 +1037,7 @@ class CheckboxTextProblemTypeBase(ChoiceTextProblemTypeTestBase):
"""
Additional setup for CheckboxTextProblemTypeBase
"""
super(CheckboxTextProblemTypeBase, self).setUp(*args, **kwargs)
super(CheckboxTextProblemTypeBase, self).setUp(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.problem_page.a11y_audit.config.set_rules({
"ignore": [
@@ -1052,7 +1052,7 @@ class CheckboxTextProblemTypeTest(CheckboxTextProblemTypeBase, ProblemTypeA11yTe
"""
Standard tests for the Checkbox Text Problem Type
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class CheckboxTextProblemTypeTestNonRandomized(CheckboxTextProblemTypeBase, ProblemTypeA11yTestMixin):
@@ -1100,11 +1100,11 @@ class SymbolicProblemTypeBase(ProblemTypeTestBase):
Answer symbolic problem.
"""
choice = "2*x+3*y" if correctness == 'correct' else "3*a+4*b"
self.problem_page.fill_answer(choice)
self.problem_page.fill_answer(choice) # lint-amnesty, pylint: disable=no-member
class SymbolicProblemTypeTest(SymbolicProblemTypeBase, ProblemTypeA11yTestMixin):
"""
Standard tests for the Symbolic Problem Type
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass

View File

@@ -20,7 +20,7 @@ from openedx.core.djangoapps.catalog.tests.factories import (
class ProgramPageBase(ProgramsConfigMixin, CatalogIntegrationMixin, UniqueCourseTest):
"""Base class used for program listing page tests."""
def setUp(self):
super(ProgramPageBase, self).setUp()
super(ProgramPageBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.set_programs_api_configuration(is_enabled=True)
@@ -79,7 +79,7 @@ class ProgramListingPageA11yTest(ProgramPageBase):
a11y = True
def setUp(self):
super(ProgramListingPageA11yTest, self).setUp()
super(ProgramListingPageA11yTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.listing_page = ProgramListingPage(self.browser)
@@ -128,7 +128,7 @@ class ProgramDetailsPageA11yTest(ProgramPageBase):
a11y = True
def setUp(self):
super(ProgramDetailsPageA11yTest, self).setUp()
super(ProgramDetailsPageA11yTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.details_page = ProgramDetailsPage(self.browser)

View File

@@ -36,7 +36,7 @@ class ProgressPageBaseTest(UniqueCourseTest):
PROBLEM_NAME_2 = 'Test Problem 2'
def setUp(self):
super(ProgressPageBaseTest, self).setUp()
super(ProgressPageBaseTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.courseware_page = CoursewarePage(self.browser, self.course_id)
self.problem_page = ProblemPage(self.browser)
self.progress_page = ProgressPage(self.browser, self.course_id)
@@ -97,14 +97,14 @@ class ProgressPageBaseTest(UniqueCourseTest):
Return a list of scores from the progress page.
"""
self.progress_page.visit()
return self.progress_page.section_score(self.SECTION_NAME, self.SUBSECTION_NAME)
return self.progress_page.section_score(self.SECTION_NAME, self.SUBSECTION_NAME) # lint-amnesty, pylint: disable=no-member
def _get_problem_scores(self):
"""
Return a list of scores from the progress page.
"""
self.progress_page.visit()
return self.progress_page.scores(self.SECTION_NAME, self.SUBSECTION_NAME)
return self.progress_page.scores(self.SECTION_NAME, self.SUBSECTION_NAME) # lint-amnesty, pylint: disable=no-member
@contextmanager
def _logged_in_session(self, staff=False):
@@ -128,7 +128,7 @@ class SubsectionGradingPolicyBase(ProgressPageBaseTest):
the progress page
"""
def setUp(self):
super(SubsectionGradingPolicyBase, self).setUp()
super(SubsectionGradingPolicyBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self._set_policy_for_subsection("Homework", 0)
self._set_policy_for_subsection("Lab", 1)
@@ -150,7 +150,7 @@ class SubsectionGradingPolicyBase(ProgressPageBaseTest):
"""
self.assertEqual(self._get_problem_scores(), problem_scores)
self.assertEqual(self._get_section_score(), section_score)
self.assertTrue(self.progress_page.text_on_page(text))
self.assertTrue(self.progress_page.text_on_page(text)) # lint-amnesty, pylint: disable=no-member
def _check_tick_text(self, index, sr_text, label, label_hidden=True):
"""

View File

@@ -22,7 +22,7 @@ class StudioCourseTest(UniqueCourseTest):
"""
Install a course with no content using a fixture.
"""
super(StudioCourseTest, self).setUp()
super(StudioCourseTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.test_xss = test_xss
self.install_course_fixture(is_staff)
@@ -58,7 +58,7 @@ class StudioCourseTest(UniqueCourseTest):
"""
Populate the children of the test course fixture.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
def log_in(self, user, is_staff=False):
"""
@@ -70,7 +70,7 @@ class StudioCourseTest(UniqueCourseTest):
user(dict): dictionary containing user data: {'username': ..., 'email': ..., 'password': ...}
is_staff(bool): register this user as staff
"""
self.auth_page = AutoAuthPage(
self.auth_page = AutoAuthPage( # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.browser,
staff=is_staff,
username=user.get('username'),
@@ -85,12 +85,12 @@ class ContainerBase(StudioCourseTest):
Base class for tests that do operations on the container page.
"""
def setUp(self, is_staff=False):
def setUp(self, is_staff=False): # lint-amnesty, pylint: disable=arguments-differ
"""
Create a unique identifier for the course used in this test.
"""
# Ensure that the superclass sets up
super(ContainerBase, self).setUp(is_staff=is_staff)
super(ContainerBase, self).setUp(is_staff=is_staff) # lint-amnesty, pylint: disable=super-with-arguments
self.outline = CourseOutlinePage(
self.browser,
@@ -115,7 +115,7 @@ class ContainerBase(StudioCourseTest):
If make_draft is true, the unit page will be put into draft mode.
"""
self.outline.visit()
subsection = self.outline.section(section_name).subsection(subsection_name)
subsection = self.outline.section(section_name).subsection(subsection_name) # lint-amnesty, pylint: disable=no-member
return subsection.expand_subsection().unit(unit_name).go_to()
def do_action_and_verify(self, action, expected_ordering):
@@ -142,7 +142,7 @@ class StudioLibraryTest(AcceptanceTest):
"""
Install a library with no content using a fixture.
"""
super(StudioLibraryTest, self).setUp()
super(StudioLibraryTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
fixture = LibraryFixture(
'test_org',
self.unique_id,
@@ -160,7 +160,7 @@ class StudioLibraryTest(AcceptanceTest):
"""
Populate the children of the test course fixture.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
def log_in(self, user, is_staff=False):
"""

View File

@@ -22,7 +22,7 @@ class StudioSettingsA11yTest(StudioCourseTest):
"""
def setUp(self): # pylint: disable=arguments-differ
super(StudioSettingsA11yTest, self).setUp()
super(StudioSettingsA11yTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.settings_page = SettingsPage(self.browser, self.course_info['org'], self.course_info['number'],
self.course_info['run'])
@@ -67,7 +67,7 @@ class StudioSubsectionSettingsA11yTest(StudioCourseTest):
browser = 'firefox'
with patch.dict(os.environ, {'SELENIUM_BROWSER': browser}):
super(StudioSubsectionSettingsA11yTest, self).setUp(is_staff=True)
super(StudioSubsectionSettingsA11yTest, self).setUp(is_staff=True) # lint-amnesty, pylint: disable=super-with-arguments
self.course_outline = CourseOutlinePage(
self.browser,

View File

@@ -50,7 +50,7 @@ class VideoBaseTest(UniqueCourseTest):
"""
Initialization of pages and course fixture for video tests
"""
super(VideoBaseTest, self).setUp()
super(VideoBaseTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.longMessage = True
self.video = VideoPage(self.browser)
@@ -229,7 +229,7 @@ class LMSVideoBlockA11yTest(VideoBaseTest):
browser = 'firefox'
with patch.dict(os.environ, {'SELENIUM_BROWSER': browser}):
super(LMSVideoBlockA11yTest, self).setUp()
super(LMSVideoBlockA11yTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
def test_video_player_a11y(self):
# load transcripts so we can test skipping to

View File

@@ -7,7 +7,7 @@ import functools
import sys
from contextlib import contextmanager
import pytest
import pytest # lint-amnesty, pylint: disable=unused-import
from django.dispatch import Signal
from markupsafe import escape
from mock import Mock, patch
@@ -25,7 +25,7 @@ def nostderr():
""" /dev/null incarnation as output-stream-like object """
def write(self, _):
""" Write method - just does nothing"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
sys.stderr = Devnull()
try:
@@ -88,7 +88,7 @@ class MockSignalHandlerMixin(object):
with patch.object(module, signal, new=Signal()) as mock_signal:
def handler(*args, **kwargs): # pylint: disable=unused-argument
"""No-op signal handler."""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
mock_handler = Mock(spec=handler)
mock_signal.connect(mock_handler)
yield
@@ -121,7 +121,7 @@ class MockS3BotoMixin(object):
TestCase mixin that mocks the S3BotoStorage save method and s3 connection.
"""
def setUp(self):
super(MockS3BotoMixin, self).setUp()
super(MockS3BotoMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self._mocked_connection = patch('boto.connect_s3', return_value=Mock())
self.mocked_connection = self._mocked_connection.start()
@@ -131,7 +131,7 @@ class MockS3BotoMixin(object):
def tearDown(self):
self._mocked_connection.stop()
self.patcher.stop()
super(MockS3BotoMixin, self).tearDown()
super(MockS3BotoMixin, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
class reprwrapper(object):

View File

@@ -11,10 +11,10 @@ import logging
import six
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.core.exceptions import ObjectDoesNotExist
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models import Count, Q
from django.db.models import Count, Q # lint-amnesty, pylint: disable=unused-import
from django.urls import reverse
from edx_proctoring.api import get_exam_violation_report
from opaque_keys.edx.keys import CourseKey, UsageKey
@@ -426,7 +426,7 @@ def course_registration_features(features, registration_codes, csv_type):
site_name = configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
registration_features = [x for x in COURSE_REGISTRATION_FEATURES if x in features]
course_registration_dict = dict((feature, getattr(registration_code, feature)) for feature in registration_features)
course_registration_dict = dict((feature, getattr(registration_code, feature)) for feature in registration_features) # lint-amnesty, pylint: disable=line-too-long
course_registration_dict['company_name'] = None
if registration_code.invoice_item:
course_registration_dict['company_name'] = registration_code.invoice_item.invoice.company_name

View File

@@ -52,7 +52,7 @@ class ProfileDistribution(object):
class ValidationError(ValueError):
""" Error thrown if validation fails. """
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
def __init__(self, feature):
self.feature = feature
@@ -112,7 +112,7 @@ def profile_distribution(course_id, feature):
# short name and display name (full) of the choices.
choices = [(short, full)
for (short, full) in raw_choices] + [('no_data', 'No Data')]
for (short, full) in raw_choices] + [('no_data', 'No Data')] # lint-amnesty, pylint: disable=unnecessary-comprehension
def get_filter(feature, value):
""" Get the orm filter parameters for a feature. """
@@ -130,7 +130,7 @@ def profile_distribution(course_id, feature):
).count()
distribution = {}
for (short, full) in choices:
for (short, full) in choices: # lint-amnesty, pylint: disable=unused-variable
# handle no data case
if short == 'no_data':
distribution['no_data'] = 0

View File

@@ -5,23 +5,23 @@ Tests for instructor.basic
import ddt
import datetime
import json
import datetime # lint-amnesty, pylint: disable=unused-import, wrong-import-order
import json # lint-amnesty, pylint: disable=wrong-import-order
import pytz
from django.db.models import Q
from django.urls import reverse
import pytz # lint-amnesty, pylint: disable=unused-import
from django.db.models import Q # lint-amnesty, pylint: disable=unused-import
from django.urls import reverse # lint-amnesty, pylint: disable=unused-import
from edx_proctoring.api import create_exam
from edx_proctoring.models import ProctoredExamStudentAttempt
from mock import MagicMock, Mock, patch
from opaque_keys.edx.locator import UsageKey
from six import text_type
from six import text_type # lint-amnesty, pylint: disable=unused-import
from six.moves import range, zip
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
from common.djangoapps.course_modes.models import CourseMode # lint-amnesty, pylint: disable=unused-import
from common.djangoapps.course_modes.tests.factories import CourseModeFactory # lint-amnesty, pylint: disable=unused-import
from lms.djangoapps.courseware.tests.factories import InstructorFactory
from lms.djangoapps.instructor_analytics.basic import (
from lms.djangoapps.instructor_analytics.basic import ( # lint-amnesty, pylint: disable=unused-import
AVAILABLE_FEATURES,
PROFILE_FEATURES,
STUDENT_FEATURES,
@@ -36,7 +36,7 @@ from lms.djangoapps.instructor_analytics.basic import (
)
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAllowed
from common.djangoapps.student.roles import CourseSalesAdminRole
from common.djangoapps.student.roles import CourseSalesAdminRole # lint-amnesty, pylint: disable=unused-import
from common.djangoapps.student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@@ -47,7 +47,7 @@ class TestAnalyticsBasic(ModuleStoreTestCase):
""" Test basic analytics functions. """
def setUp(self):
super(TestAnalyticsBasic, self).setUp()
super(TestAnalyticsBasic, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course_key = self.store.make_course_key('robot', 'course', 'id')
self.users = tuple(UserFactory() for _ in range(30))
self.ces = tuple(CourseEnrollment.enroll(user, self.course_key)

View File

@@ -105,7 +105,7 @@ class TestAnalyticsFormatInstances(TestCase):
return 'dval'
def setUp(self):
super(TestAnalyticsFormatInstances, self).setUp()
super(TestAnalyticsFormatInstances, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.instances = [self.TestDataClass() for _ in range(5)]
def test_format_instances_response(self):

View File

@@ -15,7 +15,7 @@ class TestAnalyticsDistributions(TestCase):
'''Test analytics distribution gathering.'''
def setUp(self):
super(TestAnalyticsDistributions, self).setUp()
super(TestAnalyticsDistributions, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course_id = CourseLocator('robot', 'course', 'id')
self.users = [UserFactory(
@@ -78,7 +78,7 @@ class TestAnalyticsDistributionsNoData(TestCase):
'''Test analytics distribution gathering.'''
def setUp(self):
super(TestAnalyticsDistributionsNoData, self).setUp()
super(TestAnalyticsDistributionsNoData, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course_id = CourseLocator('robot', 'course', 'id')
self.users = [UserFactory(

View File

@@ -1,2 +1,2 @@
# pylint: disable=missing-module-docstring
# lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring
default_app_config = 'lms.djangoapps.instructor_task.apps.InstructorTaskConfig'

View File

@@ -12,7 +12,7 @@ from .config.models import GradeReportSetting
from .models import InstructorTask
def mark_tasks_as_failed(modeladmin, request, queryset):
def mark_tasks_as_failed(modeladmin, request, queryset): # lint-amnesty, pylint: disable=unused-argument
queryset.update(
task_state='FAILURE',
task_output='{}',
@@ -22,7 +22,7 @@ def mark_tasks_as_failed(modeladmin, request, queryset):
mark_tasks_as_failed.short_description = "Mark Tasks as Failed"
class InstructorTaskAdmin(admin.ModelAdmin):
class InstructorTaskAdmin(admin.ModelAdmin): # lint-amnesty, pylint: disable=missing-class-docstring
actions = [mark_tasks_as_failed]
list_display = [
'task_id',

View File

@@ -51,7 +51,7 @@ class SpecificStudentIdMissingError(Exception):
"""
Exception indicating that a student id was not provided when generating a certificate for a specific student.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
def get_running_instructor_tasks(course_id):

View File

@@ -35,7 +35,7 @@ class AlreadyRunningError(Exception):
if not message:
message = self.message
super(AlreadyRunningError, self).__init__(message)
super(AlreadyRunningError, self).__init__(message) # lint-amnesty, pylint: disable=super-with-arguments
class QueueConnectionError(Exception):
@@ -47,7 +47,7 @@ class QueueConnectionError(Exception):
def __init__(self, message=None):
if not message:
message = self.message
super(QueueConnectionError, self).__init__(message)
super(QueueConnectionError, self).__init__(message) # lint-amnesty, pylint: disable=super-with-arguments
def _task_is_running(course_id, task_type, task_key):
@@ -449,7 +449,7 @@ def submit_task(request, task_type, task_class, course_key, task_input, task_key
try:
task_class.apply_async(task_args, task_id=task_id)
except Exception as error:
except Exception as error: # lint-amnesty, pylint: disable=broad-except
_handle_instructor_task_failure(instructor_task, error)
return instructor_task

View File

@@ -10,9 +10,9 @@ class UpdateProblemModuleStateError(Exception):
Used when the current module cannot be processed and no more
modules should be attempted.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
class DuplicateTaskException(Exception):
"""Exception indicating that a task already exists or has already completed."""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass

View File

@@ -96,7 +96,7 @@ class Command(BaseCommand):
for task in tasks:
print(
"{task_state} task '{task_id}', of type '{task_type}', created on '{created}', will be marked as 'FAILURE'".format(
"{task_state} task '{task_id}', of type '{task_type}', created on '{created}', will be marked as 'FAILURE'".format( # lint-amnesty, pylint: disable=line-too-long
task_state=task.task_state,
task_id=task.task_id,
task_type=task.task_type,

View File

@@ -23,7 +23,7 @@ class TestFailOldQueueingTasksCommand(InstructorTaskTestCase):
"""
def setUp(self):
super(TestFailOldQueueingTasksCommand, self).setUp()
super(TestFailOldQueueingTasksCommand, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
type_1_queueing = InstructorTaskFactory.create(
task_state=QUEUING,

View File

@@ -25,7 +25,7 @@ from uuid import uuid4
import six
from boto.exception import BotoServerError
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.core.files.base import ContentFile
from django.db import models, transaction
from django.utils.encoding import python_2_unicode_compatible

Some files were not shown because too many files have changed in this diff Show More