mozreview: fix pep8 blank line errors (
bug 1232700); r?smacleod
This fixes the following errors:
E302 expected 2 blank lines, found 0
E303 too many blank lines (3)
MozReview-Commit-ID: Eu6TZXuFeOR
--- a/pylib/mozreview/mozreview/autoland/resources.py
+++ b/pylib/mozreview/mozreview/autoland/resources.py
@@ -602,17 +602,16 @@ class ImportPullRequestTriggerResource(W
return AUTOLAND_CONFIGURATION_ERROR
autoland_user = ext.get_settings('autoland_user')
autoland_password = ext.get_settings('autoland_password')
if not autoland_user or not autoland_password:
return AUTOLAND_CONFIGURATION_ERROR
-
# if we've seen an import for this pullrequest before, see if we have
# an existing bugid we can reuse. Otherwise, Autoland will attempt to
# extract one from the pullrequest title and if that fails, file a new
# bug.
bugid = None
prs = ImportPullRequestRequest.objects.filter(
github_user=github_user,
github_repo=github_repo,
--- a/pylib/mozreview/mozreview/autoland/views.py
+++ b/pylib/mozreview/mozreview/autoland/views.py
@@ -1,14 +1,15 @@
from django.http import HttpResponse, HttpResponseForbidden
from django.contrib.auth.decorators import login_required
from django.template.loader import Context, get_template
from mozreview.autoland.resources import import_pullrequest_trigger_resource
from reviewboard.extensions.base import get_extension_manager
+
@login_required
def import_pullrequest(request, user, repo, pullrequest):
ext = get_extension_manager().get_enabled_extension(
'mozreview.extension.MozReviewExtension')
enabled = ext.get_settings('autoland_import_pullrequest_ui_enabled', False)
if not enabled:
return HttpResponseForbidden('Importing pullrequests is disabled')
--- a/pylib/mozreview/mozreview/decorators.py
+++ b/pylib/mozreview/mozreview/decorators.py
@@ -1,15 +1,16 @@
from djblets.util.decorators import simple_decorator
from djblets.webapi.decorators import (_find_httprequest,
webapi_decorator,
webapi_login_required,
webapi_response_errors)
from djblets.webapi.errors import PERMISSION_DENIED
+
@simple_decorator
def if_ext_enabled(fn):
"""Only execute the function if the extension is enabled.
An extension kwarg is expected when calling the decorated function, which
will be used for the settings.enabled check. All SignalHook handlers can
expect an extension kwarg which is the primary use case of this decorator.
--- a/pylib/mozreview/mozreview/fields.py
+++ b/pylib/mozreview/mozreview/fields.py
@@ -110,17 +110,16 @@ class CommitsListField(CommitDataBackedF
if child.is_accessible_by(user)]
autoland_requests = AutolandRequest.objects.filter(
review_request_id=parent.id).order_by('-autoland_id')
repo_urls = set()
latest_autoland_requests = []
-
# We would like to fetch the latest AutolandRequest for each
# different repository.
for request in autoland_requests:
if request.repository_url in repo_urls:
continue
repo_urls.add(request.repository_url)
latest_autoland_requests.append(request)
--- a/pylib/mozreview/mozreview/models.py
+++ b/pylib/mozreview/mozreview/models.py
@@ -60,15 +60,14 @@ class MozReviewUserProfile(models.Model)
def has_scm_ldap_group(self, group):
"""Return True if the user is a member of the provided ldap group."""
if not self.ldap_username:
return False
return query_scm_group(self.ldap_username, group)
-
class Meta:
app_label = 'mozreview'
permissions = (
("modify_ldap_association",
"Can change ldap assocation for all users"),
)
--- a/pylib/mozreview/mozreview/templatetags/mozreview.py
+++ b/pylib/mozreview/mozreview/templatetags/mozreview.py
@@ -27,16 +27,17 @@ def isPush(review_request):
@register.filter()
def commit_id(review_request_details):
"""Return the commit id of a review request or review request draft"""
commit_data = fetch_commit_data(review_request_details)
return str(commit_data.get_for(review_request_details, COMMIT_ID_KEY))
+
def reviewer_list(review_request):
return ', '.join([user.username
for user in review_request.target_people.all()])
@register.filter()
def extra_data(review_request, key):
return review_request.extra_data[key]
--- a/pylib/mozreview/mozreview/tests/test-autoland-concurrent.py
+++ b/pylib/mozreview/mozreview/tests/test-autoland-concurrent.py
@@ -82,17 +82,16 @@ class AutolandConcurrentTest(MozReviewWe
# create try tree
add_tree(self.mr.treestatus_url, 'try')
close_tree(self.mr.treestatus_url, 'try')
except Exception:
MozReviewWebDriverTest.tearDownClass()
raise
-
def send_autoland_try_request(self, try_syntax='try: stuff'):
automation_menu = self.browser.find_element_by_id('automation-menu')
automation_menu.click()
try_btn = self.browser.find_element_by_id('autoland-try-trigger')
self.assertEqual(
try_btn.value_of_css_property('opacity'), '1')
# Clicking the button should display a trychooser dialog
@@ -103,17 +102,16 @@ class AutolandConcurrentTest(MozReviewWe
)
try_text.send_keys(try_syntax)
try_submit = self.browser.find_element_by_xpath(
'//input[@value="Submit"]')
# clicking the Submit button should display an activity indicator
try_submit.click()
-
def test_autoland_try_concurrent(self):
# We currently have four conditions for enabling the 'automation' menu
# and try button (see static/mozreview/js/autoland.js):
# 1. The review must be published
# 2. The review must be mutable by the current user
# 3. The user must have scm_level_1 or higher
# 4. The repository must have an associated try repository
# TODO: Ideally we'd test these conditions independently to ensure that
--- a/pylib/mozreview/mozreview/tests/test-autoland-try.py
+++ b/pylib/mozreview/mozreview/tests/test-autoland-try.py
@@ -11,16 +11,17 @@ from selenium.common.exceptions import (
NoSuchElementException,
StaleElementReferenceException)
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from vcttesting.unittest import MozReviewWebDriverTest
+
class AutolandTryTest(MozReviewWebDriverTest):
@classmethod
def setUpClass(cls):
MozReviewWebDriverTest.setUpClass()
try:
self = cls('run')
self.create_users([
--- a/pylib/mozreview/mozreview/tests/test-browser-cache.py
+++ b/pylib/mozreview/mozreview/tests/test-browser-cache.py
@@ -95,16 +95,15 @@ class BrowserCacheTest(MozReviewWebDrive
self.load_rburl('r/2')
# The Commit Table shouldn't show a stale status for the second
# commit even though no operations have been performed on the
# first commit's review request.
status_el = self.get_commit_status(2)
self.assertEqual(status_el.get_attribute('class'), 'issue-count')
-
def get_commit_status(self, i):
return WebDriverWait(self.browser, 3).until(
EC.visibility_of_element_located((
By.XPATH,
"//table[@id='mozreview-child-requests']"
"/tbody/tr[%s]/td[@class='status']/*[1]" % i
)))
--- a/pylib/mozreview/mozreview/tests/test-import-pullrequest.py
+++ b/pylib/mozreview/mozreview/tests/test-import-pullrequest.py
@@ -8,16 +8,17 @@ import unittest
import selenium.webdriver.support.expected_conditions as EC
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from vcttesting.unittest import MozReviewWebDriverTest
+
@unittest.skip('importing pull requests not supported')
class ImportPullrequestTest(MozReviewWebDriverTest):
@classmethod
def setUpClass(cls):
MozReviewWebDriverTest.setUpClass()
try:
self = cls('run')
--- a/pylib/mozreview/mozreview/tests/test-reviewer-selection.py
+++ b/pylib/mozreview/mozreview/tests/test-reviewer-selection.py
@@ -11,17 +11,16 @@ from selenium.webdriver.common.by import
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from vcttesting.unittest import MozReviewWebDriverTest
class AutocompleteTest(MozReviewWebDriverTest):
-
def test_reviewer_autocomplete(self):
self.create_users([
('jsmith@example.com', 'password1', 'Jeremy Smith [:jsmith]'),
('mjane@example.com', 'password2', 'Mary Jane [:mary]'),
])
self.create_ldap(b'mjane@example.com', b'mjane', 2001, b'Mary Jane')
mjb = self.user_bugzilla('mjane@example.com')
mjb.create_bug('TestProduct', 'TestComponent', 'bug1')