allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/2] allura git commit: [#7980] Fix many pep8 / pyflakes and related issues
Date Wed, 30 Sep 2015 13:49:33 GMT
Repository: allura
Updated Branches:
  refs/heads/db/7980 [created] 579b34ab4


http://git-wip-us.apache.org/repos/asf/allura/blob/579b34ab/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index cdff7c8..0e0928d 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -42,7 +42,6 @@ from forgegit import model as GM
 
 
 class _TestCase(TestController):
-
     def setUp(self):
         super(_TestCase, self).setUp()
         self.setup_with_tools()
@@ -50,8 +49,7 @@ class _TestCase(TestController):
     @with_git
     def setup_with_tools(self):
         h.set_context('test', 'src-git', neighborhood='Projects')
-        repo_dir = pkg_resources.resource_filename(
-            'forgegit', 'tests/data')
+        repo_dir = pkg_resources.resource_filename('forgegit', 'tests/data')
         c.app.repo.fs_path = repo_dir
         c.app.repo.status = 'ready'
         c.app.repo.name = 'testgit.git'
@@ -67,8 +65,7 @@ class _TestCase(TestController):
     @with_tool('test', 'Git', 'testgit-index', 'Git', type='git')
     def setup_testgit_index_repo(self):
         h.set_context('test', 'testgit-index', neighborhood='Projects')
-        repo_dir = pkg_resources.resource_filename(
-            'forgegit', 'tests/data')
+        repo_dir = pkg_resources.resource_filename('forgegit', 'tests/data')
         c.app.repo.fs_path = repo_dir
         c.app.repo.status = 'ready'
         c.app.repo.name = 'testgit_index.git'
@@ -79,13 +76,10 @@ class _TestCase(TestController):
 
 
 class TestRootController(_TestCase):
-
-
     @with_tool('test', 'Git', 'weird-chars', 'WeirdChars', type='git')
     def _setup_weird_chars_repo(self):
         h.set_context('test', 'weird-chars', neighborhood='Projects')
-        repo_dir = pkg_resources.resource_filename(
-            'forgegit', 'tests/data')
+        repo_dir = pkg_resources.resource_filename('forgegit', 'tests/data')
         c.app.repo.fs_path = repo_dir
         c.app.repo.status = 'ready'
         c.app.repo.name = 'weird-chars.git'
@@ -135,41 +129,34 @@ class TestRootController(_TestCase):
              u'message': u'Add README', u'row': 2})
 
     def test_log(self):
-        resp = self.app.get(
-            '/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/')
+        resp = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/')
         assert 'Initial commit' in resp
         assert '<div class="markdown_content"><p>Change README</div>' in
resp
         assert 'tree/README?format=raw">Download</a>' not in resp
-        assert 'Tree' in resp.html.findAll(
-            'td')[2].text, resp.html.findAll('td')[2].text
+        assert 'Tree' in resp.html.findAll('td')[2].text, resp.html.findAll('td')[2].text
         assert 'byRick Copeland' in resp.html.findAll('td')[0].text, resp.html.findAll('td')[0].text
-        resp = self.app.get(
-            '/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/README')
+        resp = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/README')
         assert 'View' in resp.html.findAll('td')[2].text
         assert 'Change README' in resp
         assert 'tree/README?format=raw">Download</a>' in resp
         assert 'Add README' in resp
         assert "Initial commit " not in resp
-        resp = self.app.get(
-            '/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/a/b/c/')
+        resp = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/a/b/c/')
         assert 'Remove file' in resp
         assert 'Initial commit' in resp
         assert 'Add README' not in resp
         assert 'Change README' not in resp
-        resp = self.app.get(
-            '/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/not/exist')
+        resp = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/not/exist')
         assert 'No (more) commits' in resp
 
     def test_diff_ui(self):
-        r = self.app.get(
-            '/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/README')
+        r = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/?path=/README')
         assert '<div class="grid-19"><input type="button" value="Compare" class="compare_revision"></div>'
in r
         assert '<input type="checkbox" class="revision"' in r
         assert 'revision="1e146e67985dcd71c74de79613719bef7bddca4a"' in r
         assert 'url_commit="/p/test/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/">'
in r
 
-        r = self.app.get(
-            '/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/')
+        r = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/')
         assert '<div class="grid-19"><input type="button" value="Compare" class="compare_revision"></div>'
not in r
         assert '<input type="checkbox" class="revision"' not in r
         assert 'revision="1e146e67985dcd71c74de79613719bef7bddca4a"' not in r
@@ -247,10 +234,8 @@ class TestRootController(_TestCase):
     def test_file(self):
         ci = self._get_ci()
         resp = self.app.get(ci + 'tree/README')
-        assert 'README' in resp.html.find(
-            'h2', {'class': 'dark title'}).contents[2]
-        content = str(
-            resp.html.find('div', {'class': 'clip grid-19 codebrowser'}))
+        assert 'README' in resp.html.find('h2', {'class': 'dark title'}).contents[2]
+        content = str(resp.html.find('div', {'class': 'clip grid-19 codebrowser'}))
         assert 'This is readme' in content, content
         assert '<span id="l1" class="code_block">' in resp
         assert 'var hash = window.location.hash.substring(1);' in resp
@@ -261,16 +246,14 @@ class TestRootController(_TestCase):
         url = ci + 'tree/' + h.urlquote(u'привіт.txt') + '?format=raw'
         resp = self.app.get(url)
         assert_in(u'Привіт!\nWhich means Hello!', resp.body.decode('utf-8'))
-        assert_equal(
-            resp.headers.get('Content-Disposition').decode('utf-8'),
-            u'attachment;filename="привіт.txt"')
+        assert_equal(resp.headers.get('Content-Disposition').decode('utf-8'),
+                     u'attachment;filename="привіт.txt"')
 
         url = ci + 'tree/' + h.urlquote(u'with space.txt') + '?format=raw'
         resp = self.app.get(url)
         assert_in(u'with space', resp.body.decode('utf-8'))
-        assert_equal(
-            resp.headers.get('Content-Disposition').decode('utf-8'),
-            u'attachment;filename="with space.txt"')
+        assert_equal(resp.headers.get('Content-Disposition').decode('utf-8'),
+                     u'attachment;filename="with space.txt"')
 
     def test_invalid_file(self):
         ci = self._get_ci()
@@ -278,8 +261,7 @@ class TestRootController(_TestCase):
 
     def test_diff(self):
         ci = self._get_ci()
-        resp = self.app.get(
-            ci + 'tree/README?diff=df30427c488aeab84b2352bdf88a3b19223f9d7a')
+        resp = self.app.get(ci + 'tree/README?diff=df30427c488aeab84b2352bdf88a3b19223f9d7a')
         assert 'readme' in resp, resp.showbrowser()
         assert '+++' in resp, resp.showbrowser()
 
@@ -287,8 +269,7 @@ class TestRootController(_TestCase):
         ci = self._get_ci()
         fn = 'tree/README?diff=df30427c488aeab84b2352bdf88a3b19223f9d7a'
         r = self.app.get(ci + fn + '&diformat=regular')
-        assert fn + \
-            '&amp;diformat=sidebyside">Switch to side-by-side view</a>' in r
+        assert fn + '&amp;diformat=sidebyside">Switch to side-by-side view</a>'
in r
 
         r = self.app.get(ci + fn + '&diformat=sidebyside')
         assert fn + '&amp;diformat=regular">Switch to unified view</a>' in r
@@ -297,8 +278,7 @@ class TestRootController(_TestCase):
     def test_refresh(self):
         notification = M.Notification.query.find({'subject': '[test:src-git] 5 new commits
to Git'}).first()
         assert notification
-        domain = '.'.join(
-            reversed(c.app.url[1:-1].split('/'))).replace('_', '-')
+        domain = '.'.join(reversed(c.app.url[1:-1].split('/'))).replace('_', '-')
         common_suffix = tg.config['forgemail.domain']
         email = 'noreply@%s%s' % (domain, common_suffix)
         assert_in(email, notification['reply_to_address'])
@@ -306,8 +286,7 @@ class TestRootController(_TestCase):
     def test_file_force_display(self):
         ci = self._get_ci()
         resp = self.app.get(ci + 'tree/README?force=True')
-        content = str(
-            resp.html.find('div', {'class': 'clip grid-19 codebrowser'}))
+        content = str(resp.html.find('div', {'class': 'clip grid-19 codebrowser'}))
         assert re.search(r'<pre>.*This is readme', content), content
         assert '</pre>' in content, content
 
@@ -320,8 +299,7 @@ class TestRootController(_TestCase):
         r = self.app.get(ci + 'tree/index.html')
         header = r.html.find('h2', {'class': 'dark title'}).contents[2]
         assert 'index.html' in header, header
-        content = str(
-            r.html.find('div', {'class': 'clip grid-19 codebrowser'}))
+        content = str(r.html.find('div', {'class': 'clip grid-19 codebrowser'}))
         assert ('<span class="nt">&lt;h1&gt;</span>'
                 'index.html'
                 '<span class="nt">&lt;/h1&gt;</span>') in content, content
@@ -335,8 +313,7 @@ class TestRootController(_TestCase):
         header = r.html.find('h2', {'class': 'dark title'})
         assert 'index' in header.contents[3], header.contents[3]
         assert 'index.htm' in header.contents[4], header.contents[4]
-        content = str(
-            r.html.find('div', {'class': 'clip grid-19 codebrowser'}))
+        content = str(r.html.find('div', {'class': 'clip grid-19 codebrowser'}))
         assert ('<span class="nt">&lt;h1&gt;</span>'
                 'index/index.htm'
                 '<span class="nt">&lt;/h1&gt;</span>') in content, content
@@ -387,9 +364,7 @@ class TestRootController(_TestCase):
         assert not '<div id="access_urls"' in r
         r = self.app.get('/src-git/fork')
         assert not '<div id="access_urls"' in r
-        r = self.app.get(
-            ci +
-            'tree/README?diff=df30427c488aeab84b2352bdf88a3b19223f9d7a')
+        r = self.app.get(ci + 'tree/README?diff=df30427c488aeab84b2352bdf88a3b19223f9d7a')
         assert not '<div id="access_urls"' in r
         r = self.app.get(ci + 'tree/README')
         assert not '<div id="access_urls"' in r
@@ -419,8 +394,7 @@ class TestRootController(_TestCase):
         self.setup_testgit_index_repo()
         r = self.app.get('/p/test/testgit-index/ci/master/tree/index/')
         form = r.html.find('form', 'tarball')
-        assert_equal(
-            form.get('action'), '/p/test/testgit-index/ci/master/tarball')
+        assert_equal(form.get('action'), '/p/test/testgit-index/ci/master/tarball')
         assert_equal(form.input.get('value'), '/index')
 
     def test_default_branch(self):
@@ -466,7 +440,6 @@ class TestRootController(_TestCase):
 
 
 class TestRestController(_TestCase):
-
     def test_index(self):
         self.app.get('/rest/p/test/src-git/', status=200)
 
@@ -475,7 +448,6 @@ class TestRestController(_TestCase):
 
 
 class TestHasAccessAPI(TestRestApiBase):
-
     def setUp(self):
         super(TestHasAccessAPI, self).setUp()
         self.setup_with_tools()
@@ -485,9 +457,9 @@ class TestHasAccessAPI(TestRestApiBase):
         pass
 
     def test_has_access_no_params(self):
-        r = self.api_get('/rest/p/test/src-git/has_access', status=404)
-        r = self.api_get('/rest/p/test/src-git/has_access?user=root', status=404)
-        r = self.api_get('/rest/p/test/src-git/has_access?perm=read', status=404)
+        self.api_get('/rest/p/test/src-git/has_access', status=404)
+        self.api_get('/rest/p/test/src-git/has_access?user=root', status=404)
+        self.api_get('/rest/p/test/src-git/has_access?perm=read', status=404)
 
     def test_has_access_unknown_params(self):
         """Unknown user and/or permission always False for has_access API"""
@@ -526,7 +498,6 @@ class TestHasAccessAPI(TestRestApiBase):
 
 
 class TestFork(_TestCase):
-
     def setUp(self):
         super(TestFork, self).setUp()
         to_project = M.Project.query.get(
@@ -575,7 +546,8 @@ class TestFork(_TestCase):
         return r
 
     def _find_request_merge_form(self, resp):
-        cond = lambda f: f.action == 'do_request_merge'
+        def cond(f):
+            return f.action == 'do_request_merge'
         return self.find_form(resp, cond)
 
     def _request_merge(self, **kw):
@@ -684,8 +656,7 @@ class TestFork(_TestCase):
         assert 'Merge Request #%s:  (rejected)' % mr_num in r, r
 
     def test_merge_request_default_branches(self):
-        _select_val = lambda r, n: r.html.find(
-            'select', {'name': n}).find(selected=True).string
+        _select_val = lambda r, n: r.html.find('select', {'name': n}).find(selected=True).string
         r = self.app.get('/p/test2/code/request_merge')
         assert_equal(_select_val(r, 'source_branch'), 'master')
         assert_equal(_select_val(r, 'target_branch'), 'master')
@@ -719,11 +690,12 @@ class TestFork(_TestCase):
 
     def test_merge_request_edit(self):
         r = self.app.post('/p/test2/code/do_request_merge',
-            params={
-                'source_branch': 'zz',
-                'target_branch': 'master',
-                'summary': 'summary',
-                'description': 'description'}).follow()
+                          params={
+                              'source_branch': 'zz',
+                              'target_branch': 'master',
+                              'summary': 'summary',
+                              'description': 'description',
+                          }).follow()
         assert '<a href="edit" title="Edit"><b data-icon="p" class="ico ico-pencil"
title="Edit"></b></a>' in r
         r = self.app.get('/p/test/src-git/merge-requests/1/edit')
         assert 'value="summary"' in r
@@ -732,20 +704,24 @@ class TestFork(_TestCase):
         assert md_edit is not None, 'MarkdownEdit widget not found'
 
         r = self.app.post('/p/test/src-git/merge-requests/1/do_request_merge_edit',
-            params={
-                'source_branch': 'zz',
-                'target_branch': 'master',
-                'summary': 'changed summary',
-                'description': 'changed description'},
-                extra_environ=dict(username='*anonymous'), status=302).follow()
+                          params={
+                              'source_branch': 'zz',
+                              'target_branch': 'master',
+                              'summary': 'changed summary',
+                              'description': 'changed description'
+                          },
+                          extra_environ=dict(username='*anonymous'),
+                          status=302,
+                          ).follow()
         assert 'Login' in r
 
         r = self.app.post('/p/test/src-git/merge-requests/1/do_request_merge_edit',
-            params={
-                'source_branch': 'master',
-                'target_branch': 'master',
-                'summary': 'changed summary',
-                'description': 'changed description'}).follow()
+                          params={
+                              'source_branch': 'master',
+                              'target_branch': 'master',
+                              'summary': 'changed summary',
+                              'description': 'changed description',
+                          }).follow()
 
         assert '[5c4724]' not in r
         assert '<p>changed description</p' in r
@@ -786,7 +762,6 @@ class TestFork(_TestCase):
 
 
 class TestDiff(TestController):
-
     def setUp(self):
         super(TestDiff, self).setUp()
         self.setup_with_tools()
@@ -794,8 +769,7 @@ class TestDiff(TestController):
     @with_git
     def setup_with_tools(self):
         h.set_context('test', 'src-git', neighborhood='Projects')
-        repo_dir = pkg_resources.resource_filename(
-            'forgegit', 'tests/data')
+        repo_dir = pkg_resources.resource_filename('forgegit', 'tests/data')
         c.app.repo.fs_path = repo_dir
         c.app.repo.status = 'ready'
         c.app.repo.name = 'testmime.git'
@@ -805,19 +779,18 @@ class TestDiff(TestController):
         ThreadLocalORMSession.flush_all()
 
     def test_diff(self):
-        r = self.app.get(
-            '/src-git/ci/d961abbbf10341ee18a668c975842c35cfc0bef2/tree/1.png?barediff=2ce83a24e52c21e8d2146b1a04a20717c0bb08d7')
+        r = self.app.get('/src-git/ci/d961abbbf10341ee18a668c975842c35cfc0bef2/tree/1.png'
+                         '?barediff=2ce83a24e52c21e8d2146b1a04a20717c0bb08d7')
         assert 'alt="2ce83a2..."' in r
         assert 'alt="d961abb..."' in r
 
-        r = self.app.get(
-            '/src-git/ci/d961abbbf10341ee18a668c975842c35cfc0bef2/tree/1.png?diff=2ce83a24e52c21e8d2146b1a04a20717c0bb08d7')
+        r = self.app.get('/src-git/ci/d961abbbf10341ee18a668c975842c35cfc0bef2/tree/1.png'
+                         '?diff=2ce83a24e52c21e8d2146b1a04a20717c0bb08d7')
         assert 'alt="2ce83a2..."' in r
         assert 'alt="d961abb..."' in r
 
 
 class TestGitRename(TestController):
-
     def setUp(self):
         super(TestGitRename, self).setUp()
         self.setup_with_tools()
@@ -862,8 +835,9 @@ class TestGitRename(TestController):
 
         # the diff portion of the output
         resp_no_ws = re.sub(r'\s+', '', str(resp))
-        assert '<a href="/p/test/src-git/ci/fbb0644603bb6ecee3ebb62efe8c86efc9b84ee6/tree/f.txt">f.txt</a>to<a
href="/p/test/src-git/ci/b120505a61225e6c14bee3e5b5862db81628c35c/tree/f2.txt">f2.txt</a>'.replace('
','') \
-               in resp_no_ws
+        assert_in('<a href="/p/test/src-git/ci/fbb0644603bb6ecee3ebb62efe8c86efc9b84ee6/tree/f.txt">f.txt</a>'
+                  'to<a href="/p/test/src-git/ci/b120505a61225e6c14bee3e5b5862db81628c35c/tree/f2.txt">f2.txt</a>'
+                  .replace(' ', ''), resp_no_ws)
         assert '<span class="empty-diff">File was renamed.</span>' in resp
 
 
@@ -875,8 +849,7 @@ class TestGitBranch(TestController):
     @with_git
     def setup_with_tools(self):
         h.set_context('test', 'src-git', neighborhood='Projects')
-        repo_dir = pkg_resources.resource_filename(
-            'forgegit', 'tests/data')
+        repo_dir = pkg_resources.resource_filename('forgegit', 'tests/data')
         c.app.repo.fs_path = repo_dir
         c.app.repo.status = 'ready'
         c.app.repo.name = 'test_branch.git'
@@ -892,7 +865,6 @@ class TestGitBranch(TestController):
 
 
 class TestIncludeMacro(_TestCase):
-
     def setUp(self):
         super(TestIncludeMacro, self).setUp()
         setup_global_objects()

http://git-wip-us.apache.org/repos/asf/allura/blob/579b34ab/ForgeImporters/forgeimporters/tests/google/test_extractor.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/test_extractor.py b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
index fe74f9c..72a7d6c 100644
--- a/ForgeImporters/forgeimporters/tests/google/test_extractor.py
+++ b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
@@ -182,7 +182,8 @@ class TestGoogleCodeProjectExtractor(TestCase):
 
     @without_module('html2text')
     def test_get_issue_basic_fields(self):
-        test_issue = open(pkg_resources.resource_filename('forgeimporters', 'tests/data/google/test-issue.html')).read()
+        test_issue = open(pkg_resources.resource_filename(
+            'forgeimporters', 'tests/data/google/test-issue.html')).read()
         gpe = self._make_extractor(test_issue)
 
         self.assertEqual(gpe.get_issue_creator().name, 'john...@gmail.com')
@@ -222,7 +223,8 @@ class TestGoogleCodeProjectExtractor(TestCase):
 
     @skipif(module_not_available('html2text'))
     def test_get_issue_basic_fields_html2text(self):
-        test_issue = open(pkg_resources.resource_filename('forgeimporters', 'tests/data/google/test-issue.html')).read()
+        test_issue = open(pkg_resources.resource_filename(
+            'forgeimporters', 'tests/data/google/test-issue.html')).read()
         gpe = self._make_extractor(test_issue)
         self.assertEqual(gpe.get_issue_creator().name, 'john...@gmail.com')
         self.assertEqual(gpe.get_issue_creator().url,
@@ -303,8 +305,9 @@ class TestGoogleCodeProjectExtractor(TestCase):
         attachments = gpe.get_issue_attachments()
         self.assertEqual(len(attachments), 1)
         self.assertEqual(attachments[0].filename, 'at1.txt')
-        self.assertEqual(
-            attachments[0].url, 'http://allura-google-importer.googlecode.com/issues/attachment?aid=70000000&name=at1.txt&token=3REU1M3JUUMt0rJUg7ldcELt6LA%3A1376059941255')
+        self.assertEqual(attachments[0].url,
+                         'http://allura-google-importer.googlecode.com/issues/attachment?aid=70000000&name=at1.txt'
+                         '&token=3REU1M3JUUMt0rJUg7ldcELt6LA%3A1376059941255')
         self.assertEqual(attachments[0].type, 'text/plain')
 
     def test_get_issue_ids(self):
@@ -367,8 +370,10 @@ class TestWithSetupForComments(TestCase):
     # These tests use iter_comments and 2 HTML pages of comments.
 
     def _create_extractor(self):
-        test_issue = open(pkg_resources.resource_filename('forgeimporters', 'tests/data/google/test-issue-first-page.html')).read()
-        test_issue_older = open(pkg_resources.resource_filename('forgeimporters', 'tests/data/google/test-issue-prev-page.html')).read()
+        test_issue = open(pkg_resources.resource_filename(
+            'forgeimporters', 'tests/data/google/test-issue-first-page.html')).read()
+        test_issue_older = open(pkg_resources.resource_filename(
+            'forgeimporters', 'tests/data/google/test-issue-prev-page.html')).read()
 
         class LocalTestExtractor(google.GoogleCodeProjectExtractor):
             def urlopen(self, url, **kw):
@@ -442,7 +447,8 @@ class TestWithSetupForComments(TestCase):
                 'author.name': 'john...@gmail.com',
                 'author.url': 'http://code.google.com/u/101557263855536553789/',
                 'created_date': 'Thu Aug  8 15:36:57 2013',
-                'body': 'Oh, I forgot one \\(with an inter\\-project reference to [issue
other\\-project:1](https://code.google.com/p/other-project/issues/detail?id=1)\\)',
+                'body': 'Oh, I forgot one \\(with an inter\\-project reference to '
+                        '[issue other\\-project:1](https://code.google.com/p/other-project/issues/detail?id=1)\\)',
                 'updates': {'Labels:': 'OpSys-OSX'},
                 'attachments': [],
             },
@@ -511,7 +517,8 @@ class TestWithSetupForComments(TestCase):
                 'author.name': 'john...@gmail.com',
                 'author.url': 'http://code.google.com/u/101557263855536553789/',
                 'created_date': 'Thu Aug  8 15:36:57 2013',
-                'body': 'Oh, I forgot one \\(with an inter-project reference to [issue other-project:1](https://code.google.com/p/other-project/issues/detail?id=1)\\)',
+                'body': 'Oh, I forgot one \\(with an inter-project reference to '
+                        '[issue other-project:1](https://code.google.com/p/other-project/issues/detail?id=1)\\)',
                 'updates': {'Labels:': 'OpSys-OSX'},
                 'attachments': [],
             },

http://git-wip-us.apache.org/repos/asf/allura/blob/579b34ab/ForgeLink/forgelink/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeLink/forgelink/tests/functional/test_rest.py b/ForgeLink/forgelink/tests/functional/test_rest.py
index 7fd6485..b2ac3b3 100644
--- a/ForgeLink/forgelink/tests/functional/test_rest.py
+++ b/ForgeLink/forgelink/tests/functional/test_rest.py
@@ -91,9 +91,9 @@ class TestLinkHasAccess(TestRestApiBase):
         h.set_context('test', 'link', neighborhood='Projects')
 
     def test_has_access_no_params(self):
-        r = self.api_get('/rest/p/test/link/has_access', status=404)
-        r = self.api_get('/rest/p/test/link/has_access?user=root', status=404)
-        r = self.api_get('/rest/p/test/link/has_access?perm=read', status=404)
+        self.api_get('/rest/p/test/link/has_access', status=404)
+        self.api_get('/rest/p/test/link/has_access?user=root', status=404)
+        self.api_get('/rest/p/test/link/has_access?perm=read', status=404)
 
     def test_has_access_unknown_params(self):
         """Unknown user and/or permission always False for has_access API"""

http://git-wip-us.apache.org/repos/asf/allura/blob/579b34ab/ForgeTracker/forgetracker/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_rest.py b/ForgeTracker/forgetracker/tests/functional/test_rest.py
index 7d8d91a..4603b3d 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_rest.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_rest.py
@@ -259,9 +259,9 @@ class TestRestSearch(TestTrackerApiBase):
 class TestRestHasAccess(TestTrackerApiBase):
 
     def test_has_access_no_params(self):
-        r = self.api_get('/rest/p/test/bugs/has_access', status=404)
-        r = self.api_get('/rest/p/test/bugs/has_access?user=root', status=404)
-        r = self.api_get('/rest/p/test/bugs/has_access?perm=read', status=404)
+        self.api_get('/rest/p/test/bugs/has_access', status=404)
+        self.api_get('/rest/p/test/bugs/has_access?user=root', status=404)
+        self.api_get('/rest/p/test/bugs/has_access?perm=read', status=404)
 
     def test_has_access_unknown_params(self):
         """Unknown user and/or permission always False for has_access API"""

http://git-wip-us.apache.org/repos/asf/allura/blob/579b34ab/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index efcc59d..73ef421 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -67,11 +67,13 @@ class TrackerTestController(TestController):
         pass
 
     def _find_new_ticket_form(self, resp):
-        cond = lambda f: f.action.endswith('/save_ticket')
+        def cond(f):
+            return f.action.endswith('/save_ticket')
         return self.find_form(resp, cond)
 
     def _find_update_ticket_form(self, resp):
-        cond = lambda f: f.action.endswith('/update_ticket_from_widget')
+        def cond(f):
+            return f.action.endswith('/update_ticket_from_widget')
         return self.find_form(resp, cond)
 
     def new_ticket(self, mount_point='/bugs/', extra_environ=None, **kw):
@@ -363,8 +365,8 @@ class TestFunctionalController(TrackerTestController):
         assert 'test new ticket form description' in response
 
     def test_mass_edit(self):
-        ticket_view = self.new_ticket(summary='First Ticket').follow()
-        ticket_view = self.new_ticket(summary='Second Ticket').follow()
+        self.new_ticket(summary='First Ticket').follow()
+        self.new_ticket(summary='Second Ticket').follow()
         M.MonQTask.run_ready()
         first_ticket = tm.Ticket.query.find({'summary': 'First Ticket'}).first()
         second_ticket = tm.Ticket.query.find({'summary': 'Second Ticket'}).first()
@@ -627,7 +629,7 @@ class TestFunctionalController(TrackerTestController):
         r = self.app.get('/p/test/bugs/feed.atom', extra_environ=env)
         assert 'Private Ticket' not in r
         # ... or in the API ...
-        r = self.app.get('/rest/p/test/bugs/2/', extra_environ=env, status=401)
+        self.app.get('/rest/p/test/bugs/2/', extra_environ=env, status=401)
         r = self.app.get('/rest/p/test/bugs/', extra_environ=env)
         assert 'Private Ticket' not in r
 
@@ -870,8 +872,8 @@ class TestFunctionalController(TrackerTestController):
         params = dict()
         inputs = f.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key('value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[f.find('textarea')['name']] = 'test comment'
         self.app.post(f['action'].encode('utf-8'), params=params,
                       headers={'Referer': '/bugs/1/'.encode("utf-8")})
@@ -881,7 +883,7 @@ class TestFunctionalController(TrackerTestController):
                       upload_files=[('file_info', 'test.txt', 'HiThere!')])
         r = self.app.get('/bugs/1/', dict(page=1))
         assert '<input class="submit delete_attachment file" type="submit" value="X"/>'
in r
-        form = r.forms[5].submit()
+        r.forms[5].submit()
         r = self.app.get('/bugs/1/', dict(page=1))
         assert '<input class="submit delete_attachment" type="submit" value="X"/>'
not in r
 
@@ -917,7 +919,7 @@ class TestFunctionalController(TrackerTestController):
         file_data = file(file_path).read()
         upload = ('attachment', file_name, file_data)
         self.new_ticket(summary='test new attachment')
-        ticket_editor = self.app.post('/bugs/1/update_ticket', {
+        self.app.post('/bugs/1/update_ticket', {
             'summary': 'zzz'
         }, upload_files=[upload]).follow()
         ticket = tm.Ticket.query.find({'ticket_num': 1}).first()
@@ -1116,8 +1118,8 @@ class TestFunctionalController(TrackerTestController):
             open_status_names='aa bb',
             closed_status_names='cc',
         )
-        r = self.app.post('/admin/bugs/set_custom_fields',
-                          params=variable_encode(params))
+        self.app.post('/admin/bugs/set_custom_fields',
+                      params=variable_encode(params))
         kw = {'custom_fields._number': ''}
         ticket_view = self.new_ticket(summary='test custom fields', **kw).follow()
         assert '<strong>Number</strong>:  --&gt;' not in ticket_view
@@ -1191,7 +1193,7 @@ class TestFunctionalController(TrackerTestController):
         assert 'Milestone' in ticket_view
         assert '1.0' in ticket_view
         assert 'zzzé' not in ticket_view
-        r = self.app.post('/bugs/update_milestones', {
+        self.app.post('/bugs/update_milestones', {
             'field_name': '_milestone',
             'milestones-0.old_name': '1.0',
             'milestones-0.new_name': 'zzzé',
@@ -1357,7 +1359,7 @@ class TestFunctionalController(TrackerTestController):
         self.new_ticket(summary='test first ticket')
         self.new_ticket(summary='test second ticket')
         p = M.Project.query.get(shortname='test')
-        tracker = p.app_instance('bugs')
+        p.app_instance('bugs')
         t = tm.Ticket.query.get(summary='test first ticket')
         t.reported_by_id = M.User.by_username('test-user-0')._id
         t = tm.Ticket.query.get(summary='test second ticket')
@@ -1422,8 +1424,8 @@ class TestFunctionalController(TrackerTestController):
             'sort': ''}).follow()
         r = self.app.get('/bugs/')
         assert sidebar_contains(r, 'This is not too long.')
-        r = self.app.post('/admin/bugs/bins/save_bin', {
-            'summary': 'This will be truncated because it is too long to show in the sidebar
without being ridiculous.',
+        self.app.post('/admin/bugs/bins/save_bin', {
+            'summary': 'This will be truncated because it is too long to show in the sidebar
without being ridiculous',
             'terms': 'aaa',
             'old_summary': '',
             'sort': ''}).follow()
@@ -1457,8 +1459,8 @@ class TestFunctionalController(TrackerTestController):
         params = dict()
         inputs = f.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key('value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[f.find('textarea')['name']] = post_content
         r = self.app.post(f['action'].encode('utf-8'), params=params,
                           headers={'Referer': '/bugs/1/'.encode("utf-8")})
@@ -1473,8 +1475,8 @@ class TestFunctionalController(TrackerTestController):
         params = dict()
         inputs = f.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key('value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params['ticket_form.summary'] = new_summary
         r = self.app.post(f['action'].encode('utf-8'), params=params,
                           headers={'Referer': '/bugs/1/'.encode("utf-8")})
@@ -1492,8 +1494,8 @@ class TestFunctionalController(TrackerTestController):
         params = dict()
         inputs = f.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key('value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[f.find('textarea')['name']] = post_content
         r = self.app.post(f['action'].encode('utf-8'), params=params,
                           headers={'Referer': '/bugs/1/'.encode("utf-8")})
@@ -1520,8 +1522,8 @@ class TestFunctionalController(TrackerTestController):
         params = dict()
         inputs = f.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key('value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[f.find('textarea')['name']] = post_content
         self.app.post(f['action'].encode('utf-8'), params=params,
                       headers={'Referer': '/bugs/1/'.encode("utf-8")})
@@ -1534,8 +1536,8 @@ class TestFunctionalController(TrackerTestController):
         params = dict()
         inputs = post_form.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key('value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[post_form.find('textarea')['name']] = 'Tis a reply'
         r = self.app.post(post_link + 'reply',
                           params=params,
@@ -1559,7 +1561,8 @@ class TestFunctionalController(TrackerTestController):
         assert_in('test first ticket', str(ticket_rows))
         assert_in('test second ticket', str(ticket_rows))
         edit_link = response.html.find('a', {'title': 'Bulk Edit'})
-        expected_link = "/p/test/bugs/edit/?q=%21status%3Awont-fix+%26%26+%21status%3Aclosed&sort=snippet_s+asc&limit=25&filter=&page=0"
+        expected_link = "/p/test/bugs/edit/?q=%21status%3Awont-fix+%26%26+%21status%3Aclosed"\
+                        "&sort=snippet_s+asc&limit=25&filter=&page=0"
         assert_equal(expected_link, edit_link['href'])
         response = self.app.get(edit_link['href'])
         ticket_rows = response.html.find('tbody', {'class': 'ticket-list'})
@@ -2139,8 +2142,8 @@ class TestFunctionalController(TrackerTestController):
         params = dict()
         inputs = f.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key('value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[f.find('textarea')['name']] = post_content
         r = self.app.post(f['action'].encode('utf-8'), params=params,
                           headers={'Referer': '/p/test2/bugs2/1/'.encode("utf-8")})
@@ -2317,7 +2320,7 @@ class TestFunctionalController(TrackerTestController):
 
     def test_tags(self):
         p = M.Project.query.get(shortname='test')
-        tracker = p.app_instance('bugs')
+        p.app_instance('bugs')
         self.new_ticket(summary='a', labels='tag1,tag2')
         self.new_ticket(summary='b', labels='tag2')
         self.new_ticket(summary='c', labels='42cc,test')
@@ -2336,8 +2339,8 @@ class TestFunctionalController(TrackerTestController):
         params = dict()
         inputs = f.findAll('input')
         for field in inputs:
-            if field.has_key('name'):
-                params[field['name']] = field.has_key('value') and field['value'] or ''
+            if field.has_key('name'):  # nopep8 - beautifulsoup3 actually uses has_key
+                params[field['name']] = field.get('value') or ''
         params[f.find('textarea')['name']] = 'test comment'
         self.app.post(f['action'].encode('utf-8'), params=params,
                       headers={'Referer': '/bugs/1/'.encode("utf-8")})
@@ -2392,7 +2395,9 @@ class TestFunctionalController(TrackerTestController):
             return_path, rcpts, body = _client.sendmail.call_args[0]
             body = body.split('\n')
             assert 'Subject: [test:bugs] #1 test <h2> ticket' in body
-            assert_in('<p><strong> <a class="alink" href="http://localhost:8080/p/test/bugs/1/">[bugs:#1]</a>
test &lt;h2&gt; ticket</strong></p>', body)
+            assert_in('<p><strong> <a class="alink" href="http://localhost:8080/p/test/bugs/1/">[bugs:#1]</a>'
+                      ' test &lt;h2&gt; ticket</strong></p>',
+                      body)
 
     @patch('forgetracker.search.query_filter_choices')
     def test_multiselect(self, query_filter_choices):
@@ -2623,7 +2628,7 @@ class TestEmailMonitoring(TrackerTestController):
             if (('thread' in f['action']) and ('post' in f['action'])):
                 params = {i['name']: i.get('value', '')
                           for i in f.findAll('input')
-                          if i.has_key('name')}
+                          if i.has_key('name')}  # nopep8 - beautifulsoup3 actually uses
has_key
                 params[f.find('textarea')['name']] = 'foobar'
                 self.app.post(str(f['action']), params)
                 break  # Do it only once if many forms met
@@ -2869,7 +2874,7 @@ class TestBulkMove(TrackerTestController):
         original_p = M.Project.query.get(shortname='test')
         tracker = p.app_instance('bugs')
         original_tracker = original_p.app_instance('bugs')
-        r = self.app.post('/p/test/bugs/move_tickets', {
+        self.app.post('/p/test/bugs/move_tickets', {
             'tracker': str(tracker.config._id),
             '__ticket_ids': [t._id for t in tickets],
             '__search': '',
@@ -2907,7 +2912,7 @@ class TestBulkMove(TrackerTestController):
         tickets[0].subscribe(user=first_user)
         tickets[1].subscribe(user=second_user)
         M.MonQTask.query.remove()
-        r = self.app.post('/p/test/bugs/move_tickets', {
+        self.app.post('/p/test/bugs/move_tickets', {
             'tracker': str(tracker.config._id),
             '__ticket_ids': [t._id for t in tickets],
             '__search': '',
@@ -2970,7 +2975,7 @@ class TestBulkMove(TrackerTestController):
         p = M.Project.query.get(shortname='test2')
         tracker = p.app_instance('bugs2')
         M.MonQTask.query.remove()
-        r = self.app.post('/p/test/bugs/move_tickets', {
+        self.app.post('/p/test/bugs/move_tickets', {
             'tracker': str(tracker.config._id),
             '__ticket_ids': [t._id for t in tickets],
             '__search': '',

http://git-wip-us.apache.org/repos/asf/allura/blob/579b34ab/ForgeWiki/forgewiki/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_rest.py b/ForgeWiki/forgewiki/tests/functional/test_rest.py
index 3bc61bb..4aba7f1 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_rest.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_rest.py
@@ -131,9 +131,9 @@ class TestWikiHasAccess(TestRestApiBase):
         h.set_context('test', 'wiki', neighborhood='Projects')
 
     def test_has_access_no_params(self):
-        r = self.api_get('/rest/p/test/wiki/has_access', status=404)
-        r = self.api_get('/rest/p/test/wiki/has_access?user=root', status=404)
-        r = self.api_get('/rest/p/test/wiki/has_access?perm=read', status=404)
+        self.api_get('/rest/p/test/wiki/has_access', status=404)
+        self.api_get('/rest/p/test/wiki/has_access?user=root', status=404)
+        self.api_get('/rest/p/test/wiki/has_access?perm=read', status=404)
 
     def test_has_access_unknown_params(self):
         """Unknown user and/or permission always False for has_access API"""

http://git-wip-us.apache.org/repos/asf/allura/blob/579b34ab/scripts/teamforge-import.py
----------------------------------------------------------------------
diff --git a/scripts/teamforge-import.py b/scripts/teamforge-import.py
index 9f601a0..b668128 100644
--- a/scripts/teamforge-import.py
+++ b/scripts/teamforge-import.py
@@ -305,18 +305,7 @@ def convert_project_shortname(teamforge_path):
 
 # FIXME hardcoded
 skip_perms_usernames = set([
-    'faisal_saeed', 'dsarkisian', 'debonairamit', 'nishanthiremath', 'Bhuvnesh', 'bluetooth',
'cnkurzke', 'makow2', 'jannes1', 'Joel_Hegberg', 'Farroc', 'brian_chen', 'eirikur',
-    'dmitry_flyorov', 'bipingm', 'MornayJo', 'ibv', 'b_weisshaar', 'k9srb', 'johnmmills',
'a_gomolitsky', 'filim', 'kapoor', 'ljzegers', 'jrukes', 'dwilson9', 'jlin', 'quickie',
-    'johnbell', 'nnikolenko', 'Gaetan', 'Giannetta', 'Katia', 'jackhan', 'jacobwangus', 'adwankar',
'dinobrusco', 'qbarnes', 'ilmojung', 'clifford_chan', 'nbaig', 'fhutchi1',
-    'rinofarina', 'baiyanbin', 'muralidhar', 'duanyiruo', 'bredding', 'mkolkey', 'manvith',
'nanduk', 'engyihan', 'deepsie', 'dabon', 'dino_jiang', 'mattrose', 'peter_j_wilhelm',
-    'emx2500', 'jmcguire', 'lfilimowski', 'guruppandit', 'abhilashisme', 'edwinhm', 'rabbi',
'ferrans', 'guna', 'kevin_robinson', 'adathiruthi', 'kochen', 'onehap', 'kalanithi',
-    'jamesn', 'obu001', 'chetanv', 'Avinash', 'HugoBoss', 'Han_Wei', 'mhooper', 'g16872',
'mfcarignano', 'jim_burke', 'kevin', 'arunkarra', 'adam_feng', 'pavan_scm', 'kostya_katz',
-    'ppazderka', 'eileenzhuang', 'pyammine', 'judyho', 'ashoykh', 'rdemento', 'ibrahim',
'min_wang', 'arvind_setlur', 'moorthy_karthik', 'daniel_nelson', 'dms', 'esnmurthy',
-    'rasa_bonyadlou', 'prashantjoshi', 'edkeating', 'billsaez', 'cambalindo', 'jims', 'bozkoyun',
'andry_deltsov', 'bpowers', 'manuel_milli', 'maryparsons', 'spriporov', 'yutianli',
-    'xiebin', 'tnemeth1', 'udayaps', 'zzzzuser', 'timberger', 'sbarve1', 'zarman', 'rwallace67',
'thangavelu_arum', 'yuhuaixie', 'tingup', 'sekchai', 'sasanplus', 'rupal', 'sebastien_hertz',
-    'sab8123', 'rony_lim', 'slava_kirillin', 'smwest', 'wendydu_yq', 'sco002', 'RonFred',
'spatnala', 'vd', 'Sunny', 'tthompson', 'sunijams', 'slaw', 'rodovich', 'zhangqingqi82', 'venki',
-    'yuntaom', 'xiaojin', 'walterciocosta', 'straus', 'Thomas', 'stupka', 'wangyu', 'yaowang',
'wisekb', 'tyler_louie', 'smartgarfield', 'shekar_mahalingam',
-    'venkata_akella', 'v_yellapragada', 'vavasthi', 'rpatel', 'zhengfang', 'sweetybala',
'vap', 'sergey', 'ymhuang', 'spatel78745'
+    'username1', 'username2', 'username3'
 ])
 
 
@@ -583,9 +572,9 @@ def import_discussion(project, pid, frs_mapping, sf_project_shortname,
nbhd):
                                 parent=p.parent, timestamp=create_date)
                             p.slug = slug
                             p.full_slug = full_slug
-                            if oldest_post == None or oldest_post.timestamp > create_date:
+                            if oldest_post is None or oldest_post.timestamp > create_date:
                                 oldest_post = p
-                            if newest_post == None or newest_post.timestamp < create_date:
+                            if newest_post is None or newest_post.timestamp < create_date:
                                 newest_post = p
                             ThreadLocalORMSession.flush_all()
                     to.num_replies = to_num_replies
@@ -901,7 +890,8 @@ def _dir_sql(created_on, project, dir_name, rel_path):
       AND pfs_type = 'd'
       AND pfs_name = '%s'
       AND parent_directory = %s;
-    """ % (created_on, convert_project_shortname(project.path), options.neighborhood_shortname,
dir_name, parent_directory)
+    """ % (created_on, convert_project_shortname(project.path), options.neighborhood_shortname,
+           dir_name, parent_directory)
     return sql
 
 


Mime
View raw message