Applied pylint-amnesty to common/{lib, test, __init__.py}

This commit is contained in:
Jawayria
2021-02-02 15:42:02 +05:00
parent 712a6bcc0c
commit 9e677960bf
42 changed files with 171 additions and 171 deletions

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):