allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [16/36] PEP8 cleanup
Date Fri, 10 Jan 2014 21:23:12 GMT
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_diff.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_diff.py b/Allura/allura/tests/test_diff.py
index 2dcb8a6..20f1859 100644
--- a/Allura/allura/tests/test_diff.py
+++ b/Allura/allura/tests/test_diff.py
@@ -27,8 +27,8 @@ class TestHtmlSideBySideDiff(unittest.TestCase):
 
     def test_render_change(self):
         html = self.diff._render_change(
-                'aline', 'aline <span class="diff-add">bline</span>',
-                1, 2,'aclass', 'bclass')
+            'aline', 'aline <span class="diff-add">bline</span>',
+            1, 2, 'aclass', 'bclass')
         expected = '''
 <tr>
   <td class="lineno">1</td>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_dispatch.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_dispatch.py b/Allura/allura/tests/test_dispatch.py
index cd779d9..19f9652 100644
--- a/Allura/allura/tests/test_dispatch.py
+++ b/Allura/allura/tests/test_dispatch.py
@@ -19,6 +19,7 @@ from allura.tests import TestController
 
 app = None
 
+
 class TestDispatch(TestController):
 
     validate_skip = True
@@ -27,10 +28,7 @@ class TestDispatch(TestController):
         r = self.app.get('/dispatch/foo/')
         assert r.body == 'index foo', r
         r = self.app.get('/dispatch/foo/bar')
-        assert r.body ==  "default(foo)(('bar',))", r
+        assert r.body == "default(foo)(('bar',))", r
         self.app.get('/not_found', status=404)
         self.app.get('/dispatch/', status=404)
         # self.app.get('/hello/foo/bar', status=404)
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 789af0e..6627e56 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -19,7 +19,8 @@
 
 
 import re
-import os, allura
+import os
+import allura
 import unittest
 import hashlib
 from mock import patch
@@ -47,52 +48,59 @@ def setUp():
     setup_basic_test()
     setup_with_tools()
 
+
 @td.with_wiki
 def setup_with_tools():
     setup_global_objects()
 
+
 @td.with_wiki
 def test_app_globals():
     g.oid_session()
     g.oid_session()
     with h.push_context('test', 'wiki', neighborhood='Projects'):
-        assert g.app_static('css/wiki.css') == '/nf/_static_/wiki/css/wiki.css', g.app_static('css/wiki.css')
-        assert g.url('/foo', a='foo bar') == 'http://localhost/foo?a=foo+bar', g.url('/foo', a='foo bar')
+        assert g.app_static(
+            'css/wiki.css') == '/nf/_static_/wiki/css/wiki.css', g.app_static('css/wiki.css')
+        assert g.url(
+            '/foo', a='foo bar') == 'http://localhost/foo?a=foo+bar', g.url('/foo', a='foo bar')
         assert g.url('/foo') == 'http://localhost/foo', g.url('/foo')
 
 
-@with_setup(teardown=setUp) # reset everything we changed
+@with_setup(teardown=setUp)  # reset everything we changed
 def test_macro_projects():
     file_name = 'neo-icon-set-454545-256x350.png'
-    file_path = os.path.join(allura.__path__[0],'nf','allura','images',file_name)
+    file_path = os.path.join(
+        allura.__path__[0], 'nf', 'allura', 'images', file_name)
 
     p_nbhd = M.Neighborhood.query.get(name='Projects')
     p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
     c.project = p_test
     icon_file = open(file_path)
     M.ProjectFile.save_image(
-                file_name, icon_file, content_type='image/png',
-                square=True, thumbnail_size=(48,48),
-                thumbnail_meta=dict(project_id=c.project._id,category='icon'))
+        file_name, icon_file, content_type='image/png',
+        square=True, thumbnail_size=(48, 48),
+        thumbnail_meta=dict(project_id=c.project._id, category='icon'))
     icon_file.close()
-    p_test2 = M.Project.query.get(shortname='test2', neighborhood_id=p_nbhd._id)
+    p_test2 = M.Project.query.get(
+        shortname='test2', neighborhood_id=p_nbhd._id)
     c.project = p_test2
     icon_file = open(file_path)
     M.ProjectFile.save_image(
-                file_name, icon_file, content_type='image/png',
-                square=True, thumbnail_size=(48,48),
-                thumbnail_meta=dict(project_id=c.project._id,category='icon'))
+        file_name, icon_file, content_type='image/png',
+        square=True, thumbnail_size=(48, 48),
+        thumbnail_meta=dict(project_id=c.project._id, category='icon'))
     icon_file.close()
-    p_sub1 =  M.Project.query.get(shortname='test/sub1', neighborhood_id=p_nbhd._id)
+    p_sub1 = M.Project.query.get(
+        shortname='test/sub1', neighborhood_id=p_nbhd._id)
     c.project = p_sub1
     icon_file = open(file_path)
     M.ProjectFile.save_image(
-                file_name, icon_file, content_type='image/png',
-                square=True, thumbnail_size=(48,48),
-                thumbnail_meta=dict(project_id=c.project._id,category='icon'))
+        file_name, icon_file, content_type='image/png',
+        square=True, thumbnail_size=(48, 48),
+        thumbnail_meta=dict(project_id=c.project._id, category='icon'))
     icon_file.close()
-    p_test.labels = [ 'test', 'root' ]
-    p_sub1.labels = [ 'test', 'sub1' ]
+    p_test.labels = ['test', 'root']
+    p_sub1.labels = ['test', 'sub1']
     # Make one project private
     p_test.private = False
     p_sub1.private = False
@@ -132,7 +140,8 @@ def test_macro_projects():
         assert '<img alt="A Subproject Logo"' in r, r
         r = g.markdown_wiki.convert('[[projects show_total=True sort=random]]')
         assert '<p class="macro_projects_total">3 Projects</p>' in r, r
-        r = g.markdown_wiki.convert('[[projects show_total=True private=True sort=random]]')
+        r = g.markdown_wiki.convert(
+            '[[projects show_total=True private=True sort=random]]')
         assert '<p class="macro_projects_total">1 Projects</p>' in r, r
         assert '<img alt="Test 2 Logo"' in r, r
         assert '<img alt="Test Project Logo"' not in r, r
@@ -149,14 +158,19 @@ def test_macro_download_button():
     p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
     with h.push_config(c, project=p_test):
         r = g.markdown_wiki.convert('[[download_button]]')
-    assert_equal(r, '<div class="markdown_content"><p><span class="download-button-%s" style="margin-bottom: 1em; display: block;"></span></p>\n</div>' % p_test._id)
+    assert_equal(
+        r, '<div class="markdown_content"><p><span class="download-button-%s" style="margin-bottom: 1em; display: block;"></span></p>\n</div>' %
+        p_test._id)
+
 
 def test_macro_gittip_button():
     p_nbhd = M.Neighborhood.query.get(name='Projects')
     p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
     with h.push_config(c, project=p_test):
         r = g.markdown_wiki.convert('[[gittip_button username=test]]')
-    assert_equal(r, u'<div class="markdown_content"><p><iframe height="22pt" src="https://www.gittip.com/test/widget.html" style="border: 0; margin: 0; padding: 0;" width="48pt"></iframe></p>\n</div>')
+    assert_equal(
+        r, u'<div class="markdown_content"><p><iframe height="22pt" src="https://www.gittip.com/test/widget.html" style="border: 0; margin: 0; padding: 0;" width="48pt"></iframe></p>\n</div>')
+
 
 def test_macro_neighborhood_feeds():
     p_nbhd = M.Neighborhood.query.get(name='Projects')
@@ -168,7 +182,7 @@ def test_macro_neighborhood_feeds():
         # Make project private & verify we don't see its new feed items
         anon = M.User.anonymous()
         p_test.acl.insert(0, M.ACE.deny(
-                M.ProjectRole.anonymous(p_test)._id, 'read'))
+            M.ProjectRole.anonymous(p_test)._id, 'read'))
         ThreadLocalORMSession.flush_all()
         pg = WM.Page.query.get(title='Home', app_config_id=c.app.config._id)
         pg.text = 'Change'
@@ -177,7 +191,8 @@ def test_macro_neighborhood_feeds():
         r = g.markdown_wiki.convert('[[neighborhood_feeds tool_name=wiki]]')
         new_len = len(r)
         assert new_len == orig_len
-        p = BM.BlogPost(title='test me', neighborhood_id=p_test.neighborhood_id)
+        p = BM.BlogPost(title='test me',
+                        neighborhood_id=p_test.neighborhood_id)
         p.text = 'test content'
         p.state = 'published'
         p.make_slug()
@@ -188,7 +203,8 @@ def test_macro_neighborhood_feeds():
             r = g.markdown_wiki.convert('[[neighborhood_blog_posts]]')
         assert 'test content' in r
 
-@with_setup(setUp, setUp) # start clean and reset everything we change
+
+@with_setup(setUp, setUp)  # start clean and reset everything we change
 def test_macro_members():
     p_nbhd = M.Neighborhood.query.get(name='Projects')
     p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
@@ -197,31 +213,35 @@ def test_macro_members():
     ThreadLocalORMSession.flush_all()
     r = g.markdown_wiki.convert('[[members limit=2]]')
     assert_equal(r, '<div class="markdown_content"><h6>Project Members:</h6>\n'
-        '<ul class="md-users-list">\n'
-        '<li><a href="/u/test-admin/">Test Admin</a> (admin)</li><li><a href="/u/test-user/">Test User</a></li>\n'
-        '<li class="md-users-list-more"><a href="/p/test/_members">All Members</a></li>\n'
-        '</ul>\n'
-        '</div>')
+                 '<ul class="md-users-list">\n'
+                 '<li><a href="/u/test-admin/">Test Admin</a> (admin)</li><li><a href="/u/test-user/">Test User</a></li>\n'
+                 '<li class="md-users-list-more"><a href="/p/test/_members">All Members</a></li>\n'
+                 '</ul>\n'
+                 '</div>')
+
 
-@with_setup(teardown=setUp) # reset everything we changed
+@with_setup(teardown=setUp)  # reset everything we changed
 def test_macro_members_escaping():
     user = M.User.by_username('test-admin')
     user.display_name = u'Test Admin <script>'
     r = g.markdown_wiki.convert('[[members]]')
     assert_equal(r, u'<div class="markdown_content"><h6>Project Members:</h6>\n'
-        u'<ul class="md-users-list">\n'
-        u'<li><a href="/u/test-admin/">Test Admin &lt;script&gt;</a> (admin)</li>\n'
-        u'</ul>\n</div>')
+                 u'<ul class="md-users-list">\n'
+                 u'<li><a href="/u/test-admin/">Test Admin &lt;script&gt;</a> (admin)</li>\n'
+                 u'</ul>\n</div>')
 
-@with_setup(teardown=setUp) # reset everything we changed
+
+@with_setup(teardown=setUp)  # reset everything we changed
 def test_macro_project_admins():
     user = M.User.by_username('test-admin')
     user.display_name = u'Test Ådmin <script>'
     with h.push_context('test', neighborhood='Projects'):
         r = g.markdown_wiki.convert('[[project_admins]]')
-    assert_equal(r, u'<div class="markdown_content"><h6>Project Admins:</h6>\n<ul class="md-users-list">\n<li><a href="/u/test-admin/">Test \xc5dmin &lt;script&gt;</a></li>\n</ul>\n</div>')
+    assert_equal(
+        r, u'<div class="markdown_content"><h6>Project Admins:</h6>\n<ul class="md-users-list">\n<li><a href="/u/test-admin/">Test \xc5dmin &lt;script&gt;</a></li>\n</ul>\n</div>')
 
-@with_setup(teardown=setUp) # reset everything we changed
+
+@with_setup(teardown=setUp)  # reset everything we changed
 def test_macro_project_admins_one_br():
     p_nbhd = M.Neighborhood.query.get(name='Projects')
     p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
@@ -266,10 +286,12 @@ def test_macro_include_extra_br():
 
 
 def test_macro_embed():
-    r = g.markdown_wiki.convert('[[embed url=http://www.youtube.com/watch?v=kOLpSPEA72U]]')
+    r = g.markdown_wiki.convert(
+        '[[embed url=http://www.youtube.com/watch?v=kOLpSPEA72U]]')
     assert '''<div class="grid-20"><iframe height="270" src="http://www.youtube.com/embed/kOLpSPEA72U?feature=oembed" width="480"></iframe></div>''' in r
     r = g.markdown_wiki.convert('[[embed url=http://vimeo.com/46163090]]')
-    assert_equal(r, '<div class="markdown_content"><p>[[embed url=http://vimeo.com/46163090]]</p></div>')
+    assert_equal(
+        r, '<div class="markdown_content"><p>[[embed url=http://vimeo.com/46163090]]</p></div>')
 
 
 def test_markdown_toc():
@@ -299,15 +321,19 @@ def test_wiki_artifact_links():
         text = g.markdown.convert('See [test:wiki:Home]')
         assert '<a class="alink" href="/p/test/wiki/Home/">[test:wiki:Home]</a>' in text, text
 
+
 def test_markdown_links():
-    text = g.markdown.convert('Read [here](http://foobar.sf.net/) about our project')
+    text = g.markdown.convert(
+        'Read [here](http://foobar.sf.net/) about our project')
     assert_in('href="http://foobar.sf.net/">here</a> about', text)
 
     text = g.markdown.convert('Read [here](/p/foobar/blah) about our project')
     assert_in('href="/p/foobar/blah">here</a> about', text)
 
     text = g.markdown.convert('Read <http://foobar.sf.net/> about our project')
-    assert_in('href="http://foobar.sf.net/">http://foobar.sf.net/</a> about', text)
+    assert_in(
+        'href="http://foobar.sf.net/">http://foobar.sf.net/</a> about', text)
+
 
 def test_markdown_and_html():
     with h.push_context('test', neighborhood='Projects'):
@@ -317,11 +343,13 @@ def test_markdown_and_html():
 
 def test_markdown_within_html():
     with h.push_context('test', neighborhood='Projects'):
-        r = g.markdown_wiki.convert('<div style="float:left" markdown>**blah**</div>')
+        r = g.markdown_wiki.convert(
+            '<div style="float:left" markdown>**blah**</div>')
     assert '''<div style="float: left;">
 <p><strong>blah</strong></p>
 </div>''' in r, r
 
+
 def test_markdown_with_html_comments():
     text = g.markdown.convert('test <!-- comment -->')
     assert '<div class="markdown_content"><p>test <!-- comment --></p></div>' == text, text
@@ -342,7 +370,8 @@ def test_markdown_basics():
         text = g.markdown.convert('# Foo!\n[Rooted]')
         assert '<a href=' not in text, text
 
-    assert '<br' in g.markdown.convert('Multi\nLine'), g.markdown.convert('Multi\nLine')
+    assert '<br' in g.markdown.convert(
+        'Multi\nLine'), g.markdown.convert('Multi\nLine')
     assert '<br' not in g.markdown.convert('Multi\n\nLine')
 
     g.markdown.convert("<class 'foo'>")  # should not raise an exception
@@ -354,7 +383,7 @@ Some text in a regular paragraph
     for i in range(10):
         print i
 ''')
-    assert 'http://localhost/' in  g.forge_markdown(email=True).convert('[Home]')
+    assert 'http://localhost/' in g.forge_markdown(email=True).convert('[Home]')
     assert 'class="codehilite"' in g.markdown.convert('''
 ~~~~
 def foo(): pass
@@ -370,7 +399,8 @@ def test_markdown_autolink():
     # beginning of doc
     assert_in('<a href=', g.markdown.convert('http://sf.net abc'))
     # beginning of a line
-    assert_in('<br />\n<a href="http://', g.markdown.convert('foobar\nhttp://sf.net abc'))
+    assert_in('<br />\n<a href="http://',
+              g.markdown.convert('foobar\nhttp://sf.net abc'))
     # no conversion of these urls:
     assert_in('a blahttp://sdf.com z',
               g.markdown.convert('a blahttp://sdf.com z'))
@@ -384,7 +414,8 @@ def test_markdown_autolink():
 def test_markdown_autolink_with_escape():
     # \_ is unnecessary but valid markdown escaping and should be considered as a regular underscore
     # (it occurs during html2text conversion during project migrations)
-    r = g.markdown.convert('a http://www.phpmyadmin.net/home\_page/security/\#target b')
+    r = g.markdown.convert(
+        'a http://www.phpmyadmin.net/home\_page/security/\#target b')
     assert 'href="http://www.phpmyadmin.net/home_page/security/#target"' in r, r
 
 
@@ -428,7 +459,8 @@ def test_sort_updated():
     with h.push_context(p_nbhd.neighborhood_project._id):
         r = g.markdown_wiki.convert('[[projects sort=last_updated]]')
         project_names = get_project_names(r)
-        updated_at = get_projects_property_in_the_same_order(project_names, 'last_updated')
+        updated_at = get_projects_property_in_the_same_order(
+            project_names, 'last_updated')
         assert updated_at == sorted(updated_at, reverse=True)
 
 
@@ -445,7 +477,8 @@ def test_filtering():
     with h.push_config(c,
                        project=p_nbhd.neighborhood_project,
                        user=M.User.by_username('test-admin')):
-        r = g.markdown_wiki.convert('[[projects category="%s"]]' % random_trove.fullpath)
+        r = g.markdown_wiki.convert(
+            '[[projects category="%s"]]' % random_trove.fullpath)
         project_names = get_project_names(r)
         assert_equal([test_project.name], project_names)
 
@@ -464,9 +497,11 @@ def test_projects_macro():
         assert two_column_style not in r
 
         # test project download button
-        r = g.markdown_wiki.convert('[[projects display_mode=list show_download_button=True]]')
+        r = g.markdown_wiki.convert(
+            '[[projects display_mode=list show_download_button=True]]')
         assert 'download-button' in r
-        r = g.markdown_wiki.convert('[[projects display_mode=list show_download_button=False]]')
+        r = g.markdown_wiki.convert(
+            '[[projects display_mode=list show_download_button=False]]')
         assert 'download-button' not in r
 
 
@@ -481,6 +516,7 @@ def test_limit_tools_macro():
         r = g.markdown_wiki.convert('[[projects grid_view_tools=wiki,admin]]')
         assert '<span>Admin</span>' in r
 
+
 @td.with_user_project('test-admin')
 @td.with_user_project('test-user-1')
 def test_myprojects_macro():
@@ -512,7 +548,8 @@ def test_hideawards_macro():
     award.full = u'Award full'
     award.created_by_neighborhood_id = p_nbhd._id
 
-    project = M.Project.query.get(neighborhood_id=p_nbhd._id, shortname=u'test')
+    project = M.Project.query.get(
+        neighborhood_id=p_nbhd._id, shortname=u'test')
 
     award_grant = M.AwardGrant(award=award,
                                granted_by_neighborhood=p_nbhd,
@@ -526,6 +563,7 @@ def test_hideawards_macro():
         r = g.markdown_wiki.convert('[[projects show_awards_banner=False]]')
         assert '<div class="feature">Award short</div>' not in r, r
 
+
 def get_project_names(r):
     """
     Extracts a list of project names from a wiki page HTML.
@@ -536,6 +574,7 @@ def get_project_names(r):
     re_proj_names = re.compile('<h2><a[^>]+>(.+)<\/a><\/h2>')
     return [e for e in re_proj_names.findall(r)]
 
+
 def get_projects_property_in_the_same_order(names, prop):
     """
     Returns a list of projects properties `prop` in the same order as
@@ -543,11 +582,12 @@ def get_projects_property_in_the_same_order(names, prop):
     It is required because results of the query are not in the same order as names.
     """
     projects = M.Project.query.find(dict(name={'$in': names})).all()
-    projects_dict = dict([(p['name'],p[prop]) for p in projects])
+    projects_dict = dict([(p['name'], p[prop]) for p in projects])
     return [projects_dict[name] for name in names]
 
 
 class TestCachedMarkdown(unittest.TestCase):
+
     def setUp(self):
         self.md = ForgeMarkdown()
         self.post = M.Post()
@@ -555,7 +595,8 @@ class TestCachedMarkdown(unittest.TestCase):
         self.expected_html = u'<p><strong>bold</strong></p>'
 
     def test_bad_source_field_name(self):
-        self.assertRaises(AttributeError, self.md.cached_convert, self.post, 'no_such_field')
+        self.assertRaises(AttributeError, self.md.cached_convert,
+                          self.post, 'no_such_field')
 
     def test_missing_cache_field(self):
         delattr(self.post, 'text_cache')
@@ -577,7 +618,7 @@ class TestCachedMarkdown(unittest.TestCase):
         self.assertEqual(html, self.expected_html)
         self.assertEqual(html, self.post.text_cache.html)
         self.assertEqual(hashlib.md5(self.post.text).hexdigest(),
-                self.post.text_cache.md5)
+                         self.post.text_cache.md5)
         self.assertTrue(self.post.text_cache.render_time > 0)
 
     @patch.dict('allura.lib.app_globals.config', markdown_cache_threshold='0')
@@ -588,7 +629,7 @@ class TestCachedMarkdown(unittest.TestCase):
         self.assertNotEqual(old, html)
         self.assertEqual(html, self.post.text_cache.html)
         self.assertEqual(hashlib.md5(self.post.text).hexdigest(),
-                self.post.text_cache.md5)
+                         self.post.text_cache.md5)
         self.assertTrue(self.post.text_cache.render_time > 0)
 
     @patch.dict('allura.lib.app_globals.config', markdown_cache_threshold='0')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index e00231f..259ecba 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -46,6 +46,7 @@ def setUp(self):
 
 
 class TestMakeSafePathPortion(TestCase):
+
     def setUp(self):
         self.f = h.make_safe_path_portion
 
@@ -78,7 +79,8 @@ def test_really_unicode():
     here_dir = path.dirname(__file__)
     s = h.really_unicode('\xef\xbb\xbf<?xml version="1.0" encoding="utf-8" ?>')
     assert s.startswith(u'\ufeff')
-    s = h.really_unicode(open(path.join(here_dir, 'data/unicode_test.txt')).read())
+    s = h.really_unicode(
+        open(path.join(here_dir, 'data/unicode_test.txt')).read())
     assert isinstance(s, unicode)
     # try non-ascii string in legacy 8bit encoding
     h.really_unicode(u'\u0410\u0401'.encode('cp1251'))
@@ -86,12 +88,14 @@ def test_really_unicode():
     s = h._attempt_encodings('foo', ['LKDJFLDK'])
     assert isinstance(s, unicode)
 
+
 def test_render_genshi_plaintext():
     here_dir = path.dirname(__file__)
     tpl = path.join(here_dir, 'data/genshi_hello_tmpl')
     text = h.render_genshi_plaintext(tpl, object='world')
     eq_(u'Hello, world!\n', text)
 
+
 def test_find_project():
     proj, rest = h.find_project('/p/test/foo')
     assert_equals(proj.shortname, 'test')
@@ -99,15 +103,18 @@ def test_find_project():
     proj, rest = h.find_project('/p/testable/foo')
     assert proj is None
 
+
 def test_make_users():
     r = h.make_users([None]).next()
     assert r.username == '*anonymous', r
 
+
 def test_make_roles():
     h.set_context('test', 'wiki', neighborhood='Projects')
     pr = M.ProjectRole.anonymous()
     assert h.make_roles([pr._id]).next() == pr
 
+
 @td.with_wiki
 def test_make_app_admin_only():
     h.set_context('test', 'wiki', neighborhood='Projects')
@@ -139,6 +146,7 @@ def test_make_app_admin_only():
     assert not c.app.is_visible_to(dev)
     assert c.app.is_visible_to(admin)
 
+
 @td.with_wiki
 def test_context_setters():
     h.set_context('test', 'wiki', neighborhood='Projects')
@@ -172,15 +180,17 @@ def test_context_setters():
     assert not hasattr(c, 'project')
     assert not hasattr(c, 'app')
 
+
 def test_encode_keys():
-    kw = h.encode_keys({u'foo':5})
+    kw = h.encode_keys({u'foo': 5})
     assert type(kw.keys()[0]) != unicode
 
+
 def test_ago():
     from datetime import datetime, timedelta
     import time
     assert_equals(h.ago(datetime.utcnow() - timedelta(days=2)), '2 days ago')
-    assert_equals(h.ago_ts(time.time() - 60*60*2), '2 hours ago')
+    assert_equals(h.ago_ts(time.time() - 60 * 60 * 2), '2 hours ago')
     d_str = (datetime.utcnow() - timedelta(hours=3)).isoformat()
     assert_equals(h.ago_string(d_str), '3 hours ago')
     assert_equals(h.ago_string('bad format'), 'unknown')
@@ -197,9 +207,11 @@ def test_urlquote_unicode():
     h.urlquote(u'\u0410')
     h.urlquoteplus(u'\u0410')
 
+
 def test_sharded_path():
     assert_equals(h.sharded_path('foobar'), 'f/fo')
 
+
 def test_paging_sanitizer():
     test_data = {
         # input (limit, page, total, zero-based): output (limit, page)
@@ -215,12 +227,17 @@ def test_paging_sanitizer():
     for input, output in test_data.iteritems():
         assert (h.paging_sanitizer(*input)) == output
 
+
 def test_render_any_markup_empty():
     assert_equals(h.render_any_markup('foo', ''), '<p><em>Empty File</em></p>')
 
+
 def test_render_any_markup_plain():
-    assert_equals(h.render_any_markup('readme.txt', '<b>blah</b>\n<script>alert(1)</script>\nfoo'),
-                  '<pre>&lt;b&gt;blah&lt;/b&gt;\n&lt;script&gt;alert(1)&lt;/script&gt;\nfoo</pre>')
+    assert_equals(
+        h.render_any_markup(
+            'readme.txt', '<b>blah</b>\n<script>alert(1)</script>\nfoo'),
+        '<pre>&lt;b&gt;blah&lt;/b&gt;\n&lt;script&gt;alert(1)&lt;/script&gt;\nfoo</pre>')
+
 
 def test_render_any_markup_formatting():
     assert_equals(h.render_any_markup('README.md', '### foo\n'
@@ -270,6 +287,7 @@ def test_get_first():
     assert_equals(h.get_first({'title': []}, 'title'), None)
     assert_equals(h.get_first({'title': ['Value']}, 'title'), 'Value')
 
+
 @patch('allura.lib.search.c')
 def test_inject_user(context):
     user = Mock(username='user01')
@@ -283,7 +301,9 @@ def test_inject_user(context):
     assert_equals(result, 'reported_by_s:"admin1" OR assigned_to_s:"admin1"')
     context.user = Mock(username='*anonymous')
     result = inject_user('reported_by_s:$USER OR assigned_to_s:$USER')
-    assert_equals(result, 'reported_by_s:"*anonymous" OR assigned_to_s:"*anonymous"')
+    assert_equals(
+        result, 'reported_by_s:"*anonymous" OR assigned_to_s:"*anonymous"')
+
 
 def test_datetimeformat():
     from datetime import date
@@ -291,8 +311,10 @@ def test_datetimeformat():
 
 
 def test_split_select_field_options():
-    assert_equals(h.split_select_field_options('"test message" test2'), ['test message', 'test2'])
-    assert_equals(h.split_select_field_options('"test message test2'), ['test', 'message', 'test2'])
+    assert_equals(h.split_select_field_options('"test message" test2'),
+                  ['test message', 'test2'])
+    assert_equals(h.split_select_field_options('"test message test2'),
+                  ['test', 'message', 'test2'])
 
 
 def test_notifications_disabled():
@@ -331,14 +353,20 @@ http://blah.com/?x=y&a=b - not escaped either
 
     dd.assert_equal(h.plain2markdown(text), expected)
 
-    dd.assert_equal(h.plain2markdown('a foo  bar\n\n    code here?', preserve_multiple_spaces=True),
-                'a foo&nbsp; bar\n\n&nbsp;&nbsp;&nbsp; code here?')
+    dd.assert_equal(
+        h.plain2markdown('a foo  bar\n\n    code here?',
+                         preserve_multiple_spaces=True),
+        'a foo&nbsp; bar\n\n&nbsp;&nbsp;&nbsp; code here?')
 
-    dd.assert_equal(h.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=True),
-                 '&nbsp;&nbsp;&nbsp; tab before \(stuff\)')
+    dd.assert_equal(
+        h.plain2markdown('\ttab before (stuff)',
+                         preserve_multiple_spaces=True),
+        '&nbsp;&nbsp;&nbsp; tab before \(stuff\)')
 
-    dd.assert_equal(h.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=False),
-                 'tab before \(stuff\)')
+    dd.assert_equal(
+        h.plain2markdown('\ttab before (stuff)',
+                         preserve_multiple_spaces=False),
+        'tab before \(stuff\)')
 
 
 @td.without_module('html2text')
@@ -376,17 +404,24 @@ back\\\\\-slash escaped
 
     dd.assert_equal(h.plain2markdown(text), expected)
 
-    dd.assert_equal(h.plain2markdown('a foo  bar\n\n    code here?', preserve_multiple_spaces=True),
-                'a foo&nbsp; bar\n\n&nbsp;&nbsp;&nbsp; code here?')
+    dd.assert_equal(
+        h.plain2markdown('a foo  bar\n\n    code here?',
+                         preserve_multiple_spaces=True),
+        'a foo&nbsp; bar\n\n&nbsp;&nbsp;&nbsp; code here?')
 
-    dd.assert_equal(h.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=True),
-                 '&nbsp;&nbsp;&nbsp; tab before \(stuff\)')
+    dd.assert_equal(
+        h.plain2markdown('\ttab before (stuff)',
+                         preserve_multiple_spaces=True),
+        '&nbsp;&nbsp;&nbsp; tab before \(stuff\)')
 
-    dd.assert_equal(h.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=False),
-                 'tab before \(stuff\)')
+    dd.assert_equal(
+        h.plain2markdown('\ttab before (stuff)',
+                         preserve_multiple_spaces=False),
+        'tab before \(stuff\)')
 
 
 class TestUrlOpen(TestCase):
+
     @patch('allura.lib.helpers.urllib2')
     def test_no_error(self, urllib2):
         r = h.urlopen('myurl')
@@ -396,6 +431,7 @@ class TestUrlOpen(TestCase):
     @patch('allura.lib.helpers.urllib2.urlopen')
     def test_socket_timeout(self, urlopen):
         import socket
+
         def side_effect(url, timeout=None):
             raise socket.timeout()
         urlopen.side_effect = side_effect
@@ -405,6 +441,7 @@ class TestUrlOpen(TestCase):
     @patch('allura.lib.helpers.urllib2.urlopen')
     def test_handled_http_error(self, urlopen):
         from urllib2 import HTTPError
+
         def side_effect(url, timeout=None):
             raise HTTPError('url', 408, 'timeout', None, None)
         urlopen.side_effect = side_effect
@@ -414,6 +451,7 @@ class TestUrlOpen(TestCase):
     @patch('allura.lib.helpers.urllib2.urlopen')
     def test_unhandled_http_error(self, urlopen):
         from urllib2 import HTTPError
+
         def side_effect(url, timeout=None):
             raise HTTPError('url', 404, 'timeout', None, None)
         urlopen.side_effect = side_effect
@@ -428,12 +466,15 @@ def test_absurl_no_request():
 @patch.object(h, 'request',
               new=Request.blank('/p/test/foobar', base_url='https://www.mysite.com/p/test/foobar'))
 def test_absurl_with_request():
-    assert_equals(h.absurl('/p/test/foobar'), 'https://www.mysite.com/p/test/foobar')
+    assert_equals(h.absurl('/p/test/foobar'),
+                  'https://www.mysite.com/p/test/foobar')
 
 
 def test_daterange():
-    assert_equals(list(h.daterange(datetime(2013, 1, 1), datetime(2013, 1, 4))),
-                 [datetime(2013, 1, 1), datetime(2013, 1, 2), datetime(2013, 1, 3)])
+    assert_equals(
+        list(h.daterange(datetime(2013, 1, 1), datetime(2013, 1, 4))),
+        [datetime(2013, 1, 1), datetime(2013, 1, 2), datetime(2013, 1, 3)])
+
 
 @patch.object(h, 'request',
               new=Request.blank('/p/test/foobar', base_url='https://www.mysite.com/p/test/foobar'))
@@ -446,7 +487,9 @@ def test_login_overlay():
         with h.login_overlay(exceptions=['foobar']):
             raise HTTPUnauthorized()
 
+
 class TestIterEntryPoints(TestCase):
+
     def _make_ep(self, name, cls):
         m = Mock()
         m.name = name
@@ -457,17 +500,20 @@ class TestIterEntryPoints(TestCase):
     @patch.dict(h.tg.config, {'disable_entry_points.allura': 'myapp'})
     def test_disabled(self, pkg_resources):
         pkg_resources.iter_entry_points.return_value = [
-                self._make_ep('myapp', object)]
+            self._make_ep('myapp', object)]
         self.assertEqual([], list(h.iter_entry_points('allura')))
 
     @patch('allura.lib.helpers.pkg_resources')
     def test_subclassed_ep(self, pkg_resources):
-        class App(object): pass
-        class BetterApp(App): pass
+        class App(object):
+            pass
+
+        class BetterApp(App):
+            pass
 
         pkg_resources.iter_entry_points.return_value = [
-                self._make_ep('myapp', App),
-                self._make_ep('myapp', BetterApp)]
+            self._make_ep('myapp', App),
+            self._make_ep('myapp', BetterApp)]
 
         eps = list(h.iter_entry_points('allura'))
         self.assertEqual(len(eps), 1)
@@ -475,16 +521,21 @@ class TestIterEntryPoints(TestCase):
 
     @patch('allura.lib.helpers.pkg_resources')
     def test_ambiguous_eps(self, pkg_resources):
-        class App(object): pass
-        class BetterApp(App): pass
-        class BestApp(object): pass
+        class App(object):
+            pass
+
+        class BetterApp(App):
+            pass
+
+        class BestApp(object):
+            pass
 
         pkg_resources.iter_entry_points.return_value = [
-                self._make_ep('myapp', App),
-                self._make_ep('myapp', BetterApp),
-                self._make_ep('myapp', BestApp)]
+            self._make_ep('myapp', App),
+            self._make_ep('myapp', BetterApp),
+            self._make_ep('myapp', BestApp)]
 
         self.assertRaisesRegexp(ImportError,
-                'Ambiguous \[allura\] entry points detected. '
-                'Multiple entry points with name "myapp".',
-                list, h.iter_entry_points('allura'))
+                                'Ambiguous \[allura\] entry points detected. '
+                                'Multiple entry points with name "myapp".',
+                                list, h.iter_entry_points('allura'))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_mail_util.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_mail_util.py b/Allura/allura/tests/test_mail_util.py
index f88b46c..8473cec 100644
--- a/Allura/allura/tests/test_mail_util.py
+++ b/Allura/allura/tests/test_mail_util.py
@@ -30,13 +30,13 @@ from alluratest.controller import setup_basic_test, setup_global_objects
 from allura.lib.utils import ConfigProxy
 
 from allura.lib.mail_util import (
-        parse_address,
-        parse_message,
-        Header,
-        is_autoreply,
-        identify_sender,
-        _parse_message_id,
-    )
+    parse_address,
+    parse_message,
+    Header,
+    is_autoreply,
+    identify_sender,
+    _parse_message_id,
+)
 from allura.lib.exceptions import AddressException
 from allura.tests import decorators as td
 
@@ -44,6 +44,7 @@ config = ConfigProxy(
     common_suffix='forgemail.domain',
     return_path='forgemail.return_path')
 
+
 class TestReactor(unittest.TestCase):
 
     def setUp(self):
@@ -70,7 +71,8 @@ class TestReactor(unittest.TestCase):
 
     @td.with_wiki
     def test_parse_address_good(self):
-        topic, project, app = parse_address('foo@wiki.test.p' + config.common_suffix)
+        topic, project, app = parse_address(
+            'foo@wiki.test.p' + config.common_suffix)
         assert_equal(topic, 'foo')
         assert_equal(project.shortname, 'test')
         assert_equal(app.__class__.__name__, 'ForgeWikiApp')
@@ -96,15 +98,15 @@ class TestReactor(unittest.TestCase):
 Дворцов и башен; корабли
 Толпой со всех концов земли
 К богатым пристаням стремятся;'''.encode(charset),
-                        'plain',
-                        charset)
+                      'plain',
+                      charset)
         p2 = MIMEText(u'''<p>По оживлённым берегам
 Громады стройные теснятся
 Дворцов и башен; корабли
 Толпой со всех концов земли
 К богатым пристаням стремятся;</p>'''.encode(charset),
-                        'plain',
-                        charset)
+                      'plain',
+                      charset)
         msg1 = MIMEMultipart()
         msg1['Message-ID'] = '<foo@bar.com>'
         msg1.attach(p1)
@@ -112,7 +114,8 @@ class TestReactor(unittest.TestCase):
         s_msg = msg1.as_string()
         msg2 = parse_message(s_msg)
         for part in msg2['parts']:
-            if part['payload'] is None: continue
+            if part['payload'] is None:
+                continue
             assert isinstance(part['payload'], unicode)
 
 
@@ -133,7 +136,8 @@ class TestHeader(object):
 
     def test_name_addr(self):
         our_header = Header(u'"теснятся"', u'<dave@b.com>')
-        assert_equal(str(our_header), '=?utf-8?b?ItGC0LXRgdC90Y/RgtGB0Y8i?= <dave@b.com>')
+        assert_equal(str(our_header),
+                     '=?utf-8?b?ItGC0LXRgdC90Y/RgtGB0Y8i?= <dave@b.com>')
 
 
 class TestIsAutoreply(object):
@@ -181,27 +185,34 @@ class TestIsAutoreply(object):
         self.msg['headers']['Return-Path'] = '<>'
         assert_true(is_autoreply(self.msg))
 
+
 class TestIdentifySender(object):
+
     @mock.patch('allura.model.EmailAddress')
     def test_arg(self, EA):
-        EA.canonical = lambda e:e
-        EA.query.get.side_effect = [mock.Mock(claimed_by_user_id=True, claimed_by_user=lambda:'user')]
+        EA.canonical = lambda e: e
+        EA.query.get.side_effect = [
+            mock.Mock(claimed_by_user_id=True, claimed_by_user=lambda:'user')]
         assert_equal(identify_sender(None, 'arg', None, None), 'user')
         EA.query.get.assert_called_once_with(_id='arg')
 
     @mock.patch('allura.model.EmailAddress')
     def test_header(self, EA):
-        EA.canonical = lambda e:e
-        EA.query.get.side_effect = [None, mock.Mock(claimed_by_user_id=True, claimed_by_user=lambda:'user')]
-        assert_equal(identify_sender(None, 'arg', {'From': 'from'}, None), 'user')
-        assert_equal(EA.query.get.call_args_list, [mock.call(_id='arg'), mock.call(_id='from')])
+        EA.canonical = lambda e: e
+        EA.query.get.side_effect = [
+            None, mock.Mock(claimed_by_user_id=True, claimed_by_user=lambda:'user')]
+        assert_equal(
+            identify_sender(None, 'arg', {'From': 'from'}, None), 'user')
+        assert_equal(EA.query.get.call_args_list,
+                     [mock.call(_id='arg'), mock.call(_id='from')])
 
     @mock.patch('allura.model.User')
     @mock.patch('allura.model.EmailAddress')
     def test_no_header(self, EA, User):
         anon = User.anonymous()
-        EA.canonical = lambda e:e
-        EA.query.get.side_effect = [None, mock.Mock(claimed_by_user_id=True, claimed_by_user=lambda:'user')]
+        EA.canonical = lambda e: e
+        EA.query.get.side_effect = [
+            None, mock.Mock(claimed_by_user_id=True, claimed_by_user=lambda:'user')]
         assert_equal(identify_sender(None, 'arg', {}, None), anon)
         assert_equal(EA.query.get.call_args_list, [mock.call(_id='arg')])
 
@@ -209,14 +220,16 @@ class TestIdentifySender(object):
     @mock.patch('allura.model.EmailAddress')
     def test_no_match(self, EA, User):
         anon = User.anonymous()
-        EA.canonical = lambda e:e
+        EA.canonical = lambda e: e
         EA.query.get.side_effect = [None, None]
-        assert_equal(identify_sender(None, 'arg', {'From': 'from'}, None), anon)
-        assert_equal(EA.query.get.call_args_list, [mock.call(_id='arg'), mock.call(_id='from')])
+        assert_equal(
+            identify_sender(None, 'arg', {'From': 'from'}, None), anon)
+        assert_equal(EA.query.get.call_args_list,
+                     [mock.call(_id='arg'), mock.call(_id='from')])
 
 
 def test_parse_message_id():
     assert_equal(_parse_message_id('<de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net>, </p/libjpeg-turbo/patches/54/de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net>'), [
-            'de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net',
-            'de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net',
-        ])
+        'de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net',
+        'de31888f6be2d87dc377d9e713876bb514548625.patches@libjpeg-turbo.p.sourceforge.net',
+    ])

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_markdown.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_markdown.py b/Allura/allura/tests/test_markdown.py
index a398087..7c6d164 100644
--- a/Allura/allura/tests/test_markdown.py
+++ b/Allura/allura/tests/test_markdown.py
@@ -24,6 +24,7 @@ from allura.lib import markdown_extensions as mde
 
 
 class TestTracRef1(unittest.TestCase):
+
     @mock.patch('allura.lib.markdown_extensions.M.Shortlink.lookup')
     def test_no_such_artifact(self, lookup):
         lookup.return_value = None
@@ -42,11 +43,14 @@ class TestTracRef1(unittest.TestCase):
         shortlink = mock.Mock(url='/p/project/tool/artifact')
         shortlink.ref.artifact.deleted = False
         lookup.return_value = shortlink
-        self.assertEqual(mde.TracRef1().sub('#100'), '[#100](/p/project/tool/artifact)')
-        self.assertEqual(mde.TracRef1().sub('r123'), '[r123](/p/project/tool/artifact)')
+        self.assertEqual(mde.TracRef1().sub('#100'),
+                         '[#100](/p/project/tool/artifact)')
+        self.assertEqual(mde.TracRef1().sub('r123'),
+                         '[r123](/p/project/tool/artifact)')
 
 
 class TestTracRef2(unittest.TestCase):
+
     @mock.patch('allura.lib.markdown_extensions.M.Shortlink.lookup')
     def test_no_such_artifact(self, lookup):
         lookup.return_value = None
@@ -63,32 +67,37 @@ class TestTracRef2(unittest.TestCase):
         lookup.return_value = shortlink
         pattern = mde.TracRef2()
         pattern.get_comment_slug = lambda *args: 'abc'
-        self.assertEqual(pattern.sub('ticket:100'), '[ticket:100](/p/project/tool/artifact/)')
-        self.assertEqual(pattern.sub('[ticket:100]'), '[[ticket:100](/p/project/tool/artifact/)]')
+        self.assertEqual(pattern.sub('ticket:100'),
+                         '[ticket:100](/p/project/tool/artifact/)')
+        self.assertEqual(pattern.sub('[ticket:100]'),
+                         '[[ticket:100](/p/project/tool/artifact/)]')
         self.assertEqual(pattern.sub('comment:13:ticket:100'),
-                '[comment:13:ticket:100](/p/project/tool/artifact/#abc)')
+                         '[comment:13:ticket:100](/p/project/tool/artifact/#abc)')
         pattern.get_comment_slug = lambda *args: None
         self.assertEqual(pattern.sub('comment:13:ticket:100'),
-                '[comment:13:ticket:100](/p/project/tool/artifact/)')
+                         '[comment:13:ticket:100](/p/project/tool/artifact/)')
 
 
 class TestTracRef3(unittest.TestCase):
+
     def test_no_app_context(self):
-        self.assertEqual(mde.TracRef3(None).sub('source:file.py'), 'source:file.py')
+        self.assertEqual(mde.TracRef3(None)
+                         .sub('source:file.py'), 'source:file.py')
 
     def test_legit_refs(self):
         app = mock.Mock(url='/p/project/tool/')
         self.assertEqual(mde.TracRef3(app).sub('source:file.py'),
-                '[source:file.py](/p/project/tool/HEAD/tree/file.py)')
+                         '[source:file.py](/p/project/tool/HEAD/tree/file.py)')
         self.assertEqual(mde.TracRef3(app).sub('source:file.py@123'),
-                '[source:file.py@123](/p/project/tool/123/tree/file.py)')
+                         '[source:file.py@123](/p/project/tool/123/tree/file.py)')
         self.assertEqual(mde.TracRef3(app).sub('source:file.py@123#L456'),
-                '[source:file.py@123#L456](/p/project/tool/123/tree/file.py#l456)')
+                         '[source:file.py@123#L456](/p/project/tool/123/tree/file.py#l456)')
         self.assertEqual(mde.TracRef3(app).sub('source:file.py#L456'),
-                '[source:file.py#L456](/p/project/tool/HEAD/tree/file.py#l456)')
+                         '[source:file.py#L456](/p/project/tool/HEAD/tree/file.py#l456)')
 
 
 class TestPatternReplacingProcessor(unittest.TestCase):
+
     @mock.patch('allura.lib.markdown_extensions.M.Shortlink.lookup')
     def test_run(self, lookup):
         shortlink = mock.Mock(url='/p/project/tool/artifact')
@@ -102,6 +111,7 @@ class TestPatternReplacingProcessor(unittest.TestCase):
 
 
 class TestCommitMessageExtension(unittest.TestCase):
+
     @mock.patch('allura.lib.markdown_extensions.TracRef2.get_comment_slug')
     @mock.patch('allura.lib.markdown_extensions.M.Shortlink.lookup')
     def test_convert(self, lookup, get_comment_slug):
@@ -132,6 +142,7 @@ Not *strong* or _underlined_."""
 * <a href="/p/project/tool/2/tree/test.py#l3">source:test.py@2#L3</a></p>
 <p>Not *strong* or _underlined_.</p></div>"""
 
-        md = ForgeMarkdown(extensions=[mde.CommitMessageExtension(app), 'nl2br'],
-                output_format='html4')
+        md = ForgeMarkdown(
+            extensions=[mde.CommitMessageExtension(app), 'nl2br'],
+            output_format='html4')
         self.assertEqual(md.convert(text), expected_html)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_plugin.py b/Allura/allura/tests/test_plugin.py
index 66d4715..1c00f61 100644
--- a/Allura/allura/tests/test_plugin.py
+++ b/Allura/allura/tests/test_plugin.py
@@ -49,7 +49,7 @@ class TestProjectRegistrationProvider(object):
     def test_suggest_name(self):
         f = self.provider.suggest_name
         assert_equals(f('A More Than Fifteen Character Name', Mock()),
-                'amorethanfifteencharactername')
+                      'amorethanfifteencharactername')
 
     @patch('allura.model.Project')
     def test_shortname_validator(self, Project):
@@ -58,14 +58,18 @@ class TestProjectRegistrationProvider(object):
         v = self.provider.shortname_validator.to_python
 
         v('thisislegit', neighborhood=nbhd)
-        assert_raises(ProjectShortnameInvalid, v, 'not valid', neighborhood=nbhd)
-        assert_raises(ProjectShortnameInvalid, v, 'this-is-valid-but-too-long', neighborhood=nbhd)
-        assert_raises(ProjectShortnameInvalid, v, 'this is invalid and too long', neighborhood=nbhd)
+        assert_raises(ProjectShortnameInvalid, v,
+                      'not valid', neighborhood=nbhd)
+        assert_raises(ProjectShortnameInvalid, v,
+                      'this-is-valid-but-too-long', neighborhood=nbhd)
+        assert_raises(ProjectShortnameInvalid, v,
+                      'this is invalid and too long', neighborhood=nbhd)
         Project.query.get.return_value = Mock()
         assert_raises(ProjectConflict, v, 'thisislegit', neighborhood=nbhd)
 
 
 class TestThemeProvider(object):
+
     @patch('allura.model.notification.SiteNotification')
     @patch('pylons.response')
     @patch('pylons.request')
@@ -103,7 +107,8 @@ class TestThemeProvider(object):
         note.impressions = 2
         request.cookies = {'site-notification': 'deadbeef-1-false'}
         assert_is(ThemeProvider().get_site_notification(), note)
-        response.set_cookie.assert_called_once_with('site-notification', 'deadbeef-2-False', max_age=timedelta(days=365))
+        response.set_cookie.assert_called_once_with(
+            'site-notification', 'deadbeef-2-False', max_age=timedelta(days=365))
 
     @patch('allura.model.notification.SiteNotification')
     @patch('pylons.response')
@@ -124,7 +129,8 @@ class TestThemeProvider(object):
         note.impressions = 1
         request.cookies = {'site-notification': '0ddba11-1000-true'}
         assert_is(ThemeProvider().get_site_notification(), note)
-        response.set_cookie.assert_called_once_with('site-notification', 'deadbeef-1-False', max_age=timedelta(days=365))
+        response.set_cookie.assert_called_once_with(
+            'site-notification', 'deadbeef-1-False', max_age=timedelta(days=365))
 
     @patch('allura.model.notification.SiteNotification')
     @patch('pylons.response')
@@ -135,7 +141,8 @@ class TestThemeProvider(object):
         note.impressions = 0
         request.cookies = {}
         assert_is(ThemeProvider().get_site_notification(), note)
-        response.set_cookie.assert_called_once_with('site-notification', 'deadbeef-1-False', max_age=timedelta(days=365))
+        response.set_cookie.assert_called_once_with(
+            'site-notification', 'deadbeef-1-False', max_age=timedelta(days=365))
 
     @patch('allura.model.notification.SiteNotification')
     @patch('pylons.response')
@@ -146,4 +153,5 @@ class TestThemeProvider(object):
         note.impressions = 0
         request.cookies = {'site-notification': 'deadbeef-1000-true-bad'}
         assert_is(ThemeProvider().get_site_notification(), note)
-        response.set_cookie.assert_called_once_with('site-notification', 'deadbeef-1-False', max_age=timedelta(days=365))
+        response.set_cookie.assert_called_once_with(
+            'site-notification', 'deadbeef-1-False', max_age=timedelta(days=365))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_scripttask.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_scripttask.py b/Allura/allura/tests/test_scripttask.py
index d97f9ef..6273ee0 100644
--- a/Allura/allura/tests/test_scripttask.py
+++ b/Allura/allura/tests/test_scripttask.py
@@ -22,9 +22,11 @@ from allura.scripts.scripttask import ScriptTask
 
 
 class TestScriptTask(unittest.TestCase):
+
     def setUp(self):
         class TestScriptTask(ScriptTask):
             _parser = mock.Mock()
+
             @classmethod
             def parser(cls):
                 return cls._parser

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_security.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_security.py b/Allura/allura/tests/test_security.py
index 0acc5ca..1445e91 100644
--- a/Allura/allura/tests/test_security.py
+++ b/Allura/allura/tests/test_security.py
@@ -32,16 +32,19 @@ def _allow(obj, role, perm):
     ThreadLocalODMSession.flush_all()
     Credentials.get().clear()
 
+
 def _deny(obj, role, perm):
     obj.acl.insert(0, M.ACE.deny(role._id, perm))
     ThreadLocalODMSession.flush_all()
     Credentials.get().clear()
 
+
 def _add_to_group(user, role):
     M.ProjectRole.by_user(user, upsert=True).roles.append(role._id)
     ThreadLocalODMSession.flush_all()
     Credentials.get().clear()
 
+
 class TestSecurity(TestController):
 
     validate_skip = True
@@ -50,21 +53,28 @@ class TestSecurity(TestController):
     def test_anon(self):
         self.app.get('/security/*anonymous/forbidden', status=302)
         self.app.get('/security/*anonymous/needs_auth', status=302)
-        self.app.get('/security/*anonymous/needs_project_access_fail', status=302)
-        self.app.get('/security/*anonymous/needs_artifact_access_fail', status=302)
+        self.app.get('/security/*anonymous/needs_project_access_fail',
+                     status=302)
+        self.app.get(
+            '/security/*anonymous/needs_artifact_access_fail', status=302)
 
     @td.with_wiki
     def test_auth(self):
         self.app.get('/security/test-admin/forbidden', status=403)
         self.app.get('/security/test-admin/needs_auth', status=200)
-        self.app.get('/security/test-admin/needs_project_access_fail', status=403)
-        self.app.get('/security/test-admin/needs_project_access_ok', status=200)
+        self.app.get('/security/test-admin/needs_project_access_fail',
+                     status=403)
+        self.app.get('/security/test-admin/needs_project_access_ok',
+                     status=200)
         # This should fail b/c test-user doesn't have the permission
-        self.app.get('/security/test-user/needs_artifact_access_fail', extra_environ=dict(username='test-user'), status=403)
+        self.app.get('/security/test-user/needs_artifact_access_fail',
+                     extra_environ=dict(username='test-user'), status=403)
         # This should succeed b/c users with the 'admin' permission on a
         # project implicitly have all permissions to everything in the project
-        self.app.get('/security/test-admin/needs_artifact_access_fail', status=200)
-        self.app.get('/security/test-admin/needs_artifact_access_ok', status=200)
+        self.app.get(
+            '/security/test-admin/needs_artifact_access_fail', status=200)
+        self.app.get('/security/test-admin/needs_artifact_access_ok',
+                     status=200)
 
     @td.with_wiki
     def test_all_allowed(self):
@@ -77,21 +87,29 @@ class TestSecurity(TestController):
         anon_role = M.ProjectRole.by_name('*anonymous')
         test_user = M.User.by_username('test-user')
 
-        assert_equal(all_allowed(wiki, admin_role), set(['configure', 'read', 'create', 'edit', 'unmoderated_post', 'post', 'moderate', 'admin', 'delete']))
-        assert_equal(all_allowed(wiki, dev_role), set(['read', 'create', 'edit', 'unmoderated_post', 'post', 'moderate', 'delete']))
-        assert_equal(all_allowed(wiki, member_role), set(['read', 'create', 'edit', 'unmoderated_post', 'post']))
-        assert_equal(all_allowed(wiki, auth_role), set(['read', 'post', 'unmoderated_post']))
+        assert_equal(all_allowed(wiki, admin_role), set(
+            ['configure', 'read', 'create', 'edit', 'unmoderated_post', 'post', 'moderate', 'admin', 'delete']))
+        assert_equal(all_allowed(wiki, dev_role), set(
+            ['read', 'create', 'edit', 'unmoderated_post', 'post', 'moderate', 'delete']))
+        assert_equal(all_allowed(wiki, member_role),
+                     set(['read', 'create', 'edit', 'unmoderated_post', 'post']))
+        assert_equal(all_allowed(wiki, auth_role),
+                     set(['read', 'post', 'unmoderated_post']))
         assert_equal(all_allowed(wiki, anon_role), set(['read']))
-        assert_equal(all_allowed(wiki, test_user), set(['read', 'post', 'unmoderated_post']))
+        assert_equal(all_allowed(wiki, test_user),
+                     set(['read', 'post', 'unmoderated_post']))
 
         _add_to_group(test_user, member_role)
 
-        assert_equal(all_allowed(wiki, test_user), set(['read', 'create', 'edit', 'unmoderated_post', 'post']))
+        assert_equal(all_allowed(wiki, test_user),
+                     set(['read', 'create', 'edit', 'unmoderated_post', 'post']))
 
         _deny(wiki, auth_role, 'unmoderated_post')
 
-        assert_equal(all_allowed(wiki, member_role), set(['read', 'create', 'edit', 'post']))
-        assert_equal(all_allowed(wiki, test_user), set(['read', 'create', 'edit', 'post']))
+        assert_equal(all_allowed(wiki, member_role),
+                     set(['read', 'create', 'edit', 'post']))
+        assert_equal(all_allowed(wiki, test_user),
+                     set(['read', 'create', 'edit', 'post']))
 
     @td.with_wiki
     def test_deny_vs_allow(self):
@@ -104,7 +122,6 @@ class TestSecurity(TestController):
         auth_role = M.ProjectRole.by_name('*authenticated')
         test_user = M.User.by_username('test-user')
 
-
         # confirm that *anon has expected access
         assert has_access(page, 'read', anon_role)()
         assert has_access(page, 'post', anon_role)()
@@ -114,7 +131,8 @@ class TestSecurity(TestController):
         assert has_access(page, 'read', test_user)()
         assert has_access(page, 'post', test_user)()
         assert has_access(page, 'unmoderated_post', test_user)()
-        assert_equal(all_allowed(page, test_user), set(['read', 'post', 'unmoderated_post']))
+        assert_equal(all_allowed(page, test_user),
+                     set(['read', 'post', 'unmoderated_post']))
 
         _deny(page, auth_role, 'read')
 
@@ -126,11 +144,11 @@ class TestSecurity(TestController):
         # FIXME: all_allowed doesn't respect blocked user feature
         #assert_equal(all_allowed(page, test_user), set(['post', 'unmoderated_post']))
 
-
         assert has_access(wiki, 'read', test_user)()
         assert has_access(wiki, 'post', test_user)()
         assert has_access(wiki, 'unmoderated_post', test_user)()
-        assert_equal(all_allowed(wiki, test_user), set(['read', 'post', 'unmoderated_post']))
+        assert_equal(all_allowed(wiki, test_user),
+                     set(['read', 'post', 'unmoderated_post']))
 
         _deny(wiki, anon_role, 'read')
         _allow(wiki, auth_role, 'read')
@@ -169,6 +187,7 @@ class TestSecurity(TestController):
         wiki = c.project.app_instance('wiki')
         user = M.User.by_username('test-user')
         assert has_access(wiki, 'read', user)()
-        wiki.acl.append(M.ACE.deny(M.ProjectRole.by_user(user, upsert=True)._id, 'read', 'Spammer'))
+        wiki.acl.append(
+            M.ACE.deny(M.ProjectRole.by_user(user, upsert=True)._id, 'read', 'Spammer'))
         Credentials.get().clear()
         assert not has_access(wiki, 'read', user)()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index d908252..101ed8a 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -53,6 +53,7 @@ from allura.lib.decorators import event_handler, task
 
 
 class TestRepoTasks(unittest.TestCase):
+
     @mock.patch('allura.tasks.repo_tasks.c.app')
     @mock.patch('allura.tasks.repo_tasks.g.post_event')
     def test_clone_posts_event_on_failure(self, post_event, app):
@@ -73,7 +74,7 @@ class TestEventTasks(unittest.TestCase):
 
     def test_fire_event(self):
         event_tasks.event('my_event', self, 1, 2, a=5)
-        assert self.called_with == [((1,2), {'a':5}) ], self.called_with
+        assert self.called_with == [((1, 2), {'a': 5})], self.called_with
 
     def test_compound_error(self):
         '''test_compound_exception -- make sure our multi-exception return works
@@ -83,7 +84,7 @@ class TestEventTasks(unittest.TestCase):
         setup_global_objects()
         t = raise_exc.post()
         with LogCapture(level=logging.ERROR) as l, \
-             mock.patch.dict(tg.config, {'monq.raise_errors': False}):  # match normal non-test behavior
+                mock.patch.dict(tg.config, {'monq.raise_errors': False}):  # match normal non-test behavior
             t()
         # l.check() would be nice, but string is too detailed to check
         assert_equal(l.records[0].name, 'allura.model.monq_model')
@@ -95,6 +96,7 @@ class TestEventTasks(unittest.TestCase):
         for x in range(10):
             assert ('assert %d' % x) in t.result
 
+
 class TestIndexTasks(unittest.TestCase):
 
     def setUp(self):
@@ -109,33 +111,36 @@ class TestIndexTasks(unittest.TestCase):
 
             old_shortlinks = M.Shortlink.query.find().count()
             old_solr_size = len(g.solr.db)
-            artifacts = [ _TestArtifact() for x in range(5) ]
+            artifacts = [_TestArtifact() for x in range(5)]
             for i, a in enumerate(artifacts):
                 a._shorthand_id = 't%d' % i
                 a.text = 'This is a reference to [t3]'
-            arefs = [ M.ArtifactReference.from_artifact(a) for a in artifacts ]
-            ref_ids = [ r._id for r in arefs ]
+            arefs = [M.ArtifactReference.from_artifact(a) for a in artifacts]
+            ref_ids = [r._id for r in arefs]
             M.artifact_orm_session.flush()
             index_tasks.add_artifacts(ref_ids)
             new_shortlinks = M.Shortlink.query.find().count()
             new_solr_size = len(g.solr.db)
-            assert old_shortlinks + 5 == new_shortlinks, 'Shortlinks not created'
-            assert old_solr_size + 5 == new_solr_size, "Solr additions didn't happen"
+            assert old_shortlinks + \
+                5 == new_shortlinks, 'Shortlinks not created'
+            assert old_solr_size + \
+                5 == new_solr_size, "Solr additions didn't happen"
             M.main_orm_session.flush()
             M.main_orm_session.clear()
             a = _TestArtifact.query.get(_shorthand_id='t3')
             assert len(a.backrefs) == 5, a.backrefs
             assert_equal(find_slinks.call_args_list,
-                    [mock.call(a.index().get('text')) for a in artifacts])
+                         [mock.call(a.index().get('text')) for a in artifacts])
 
     @td.with_wiki
     @mock.patch('allura.tasks.index_tasks.g.solr')
     def test_del_artifacts(self, solr):
         old_shortlinks = M.Shortlink.query.find().count()
-        artifacts = [ _TestArtifact(_shorthand_id='ta_%s' % x) for x in range(5) ]
+        artifacts = [_TestArtifact(_shorthand_id='ta_%s' % x)
+                     for x in range(5)]
         M.artifact_orm_session.flush()
-        arefs = [ M.ArtifactReference.from_artifact(a) for a in artifacts ]
-        ref_ids = [ r._id for r in arefs ]
+        arefs = [M.ArtifactReference.from_artifact(a) for a in artifacts]
+        ref_ids = [r._id for r in arefs]
         M.artifact_orm_session.flush()
         index_tasks.add_artifacts(ref_ids)
         M.main_orm_session.flush()
@@ -145,9 +150,9 @@ class TestIndexTasks(unittest.TestCase):
         assert solr.add.call_count == 1
         sort_key = operator.itemgetter('id')
         assert_equal(
-                sorted(solr.add.call_args[0][0], key=sort_key),
-                sorted([search.solarize(ref.artifact) for ref in arefs],
-                        key=sort_key))
+            sorted(solr.add.call_args[0][0], key=sort_key),
+            sorted([search.solarize(ref.artifact) for ref in arefs],
+                   key=sort_key))
         index_tasks.del_artifacts(ref_ids)
         M.main_orm_session.flush()
         M.main_orm_session.clear()
@@ -164,14 +169,15 @@ class TestMailTasks(unittest.TestCase):
         setup_global_objects()
 
     # these tests go down through the mail_util.SMTPClient.sendmail method
-    # since usage is generally through the task, and not using mail_util directly
+    # since usage is generally through the task, and not using mail_util
+    # directly
 
     def test_send_email_ascii_with_user_lookup(self):
         c.user = M.User.by_username('test-admin')
         with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
             mail_tasks.sendmail(
                 fromaddr=str(c.user._id),
-                destinations=[ str(c.user._id) ],
+                destinations=[str(c.user._id)],
                 text=u'This is a test',
                 reply_to=u'noreply@sf.net',
                 subject=u'Test subject',
@@ -187,13 +193,14 @@ class TestMailTasks(unittest.TestCase):
             # plain
             assert_in('This is a test', body)
             # html
-            assert_in('<div class="markdown_content"><p>This is a test</p></div>', body)
+            assert_in(
+                '<div class="markdown_content"><p>This is a test</p></div>', body)
 
     def test_send_email_nonascii(self):
         with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
             mail_tasks.sendmail(
                 fromaddr=u'"По" <foo@bar.com>',
-                destinations=[ 'blah@blah.com' ],
+                destinations=['blah@blah.com'],
                 text=u'Громады стройные теснятся',
                 reply_to=u'noreply@sf.net',
                 subject=u'По оживлённым берегам',
@@ -207,12 +214,15 @@ class TestMailTasks(unittest.TestCase):
 
             # The address portion must not be encoded, only the name portion can be.
             # Also it is apparently not necessary to have the double-quote separators present
-            #   when the name portion is encoded.  That is, the encoding below is just По and not "По"
+            # when the name portion is encoded.  That is, the encoding below is
+            # just По and not "По"
             assert_in('From: =?utf-8?b?0J/Qvg==?= <foo@bar.com>', body)
-            assert_in('Subject: =?utf-8?b?0J/QviDQvtC20LjQstC70ZHQvdC90YvQvCDQsdC10YDQtdCz0LDQvA==?=', body)
+            assert_in(
+                'Subject: =?utf-8?b?0J/QviDQvtC20LjQstC70ZHQvdC90YvQvCDQsdC10YDQtdCz0LDQvA==?=', body)
             assert_in('Content-Type: text/plain; charset="utf-8"', body)
             assert_in('Content-Transfer-Encoding: base64', body)
-            assert_in(b64encode(u'Громады стройные теснятся'.encode('utf-8')), body)
+            assert_in(
+                b64encode(u'Громады стройные теснятся'.encode('utf-8')), body)
 
     def test_send_email_with_disabled_user(self):
         c.user = M.User.by_username('test-admin')
@@ -223,7 +233,7 @@ class TestMailTasks(unittest.TestCase):
         with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
             mail_tasks.sendmail(
                 fromaddr=str(c.user._id),
-                destinations=[ str(destination_user._id) ],
+                destinations=[str(destination_user._id)],
                 text=u'This is a test',
                 reply_to=u'noreply@sf.net',
                 subject=u'Test subject',
@@ -242,7 +252,7 @@ class TestMailTasks(unittest.TestCase):
         with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
             mail_tasks.sendmail(
                 fromaddr=str(c.user._id),
-                destinations=[ str(destination_user._id) ],
+                destinations=[str(destination_user._id)],
                 text=u'This is a test',
                 reply_to=u'noreply@sf.net',
                 subject=u'Test subject',
@@ -299,7 +309,7 @@ class TestMailTasks(unittest.TestCase):
             _client.reset_mock()
             mail_tasks.sendmail(
                 fromaddr=str(c.user._id),
-                destinations=[ str(c.user._id) ],
+                destinations=[str(c.user._id)],
                 text=u'This is a test',
                 reply_to=u'123@tickets.test.p.sf.net',
                 subject=u'Test subject',
@@ -332,7 +342,7 @@ class TestMailTasks(unittest.TestCase):
             _client.reset_mock()
             mail_tasks.sendmail(
                 fromaddr=str(c.user._id),
-                destinations=[ str(c.user._id) ],
+                destinations=[str(c.user._id)],
                 text=u'This is a test',
                 reply_to=u'noreply@sf.net',
                 subject=u'Test subject',
@@ -409,10 +419,12 @@ class TestNotificationTasks(unittest.TestCase):
                 assert deliver.called_with('42', '52', 'none')
                 assert fire_ready.called_with()
 
+
 @event_handler('my_event')
 def _my_event(event_type, testcase, *args, **kwargs):
     testcase.called_with.append((args, kwargs))
 
+
 @task
 def raise_exc():
     errs = []
@@ -423,12 +435,17 @@ def raise_exc():
             errs.append(sys.exc_info())
     raise CompoundError(*errs)
 
+
 class _TestArtifact(M.Artifact):
     _shorthand_id = FieldProperty(str)
     text = FieldProperty(str)
-    def url(self): return ''
+
+    def url(self):
+        return ''
+
     def shorthand_id(self):
         return getattr(self, '_shorthand_id', self._id)
+
     def index(self):
         return dict(
             super(_TestArtifact, self).index(),
@@ -451,11 +468,13 @@ class TestExportTasks(unittest.TestCase):
         exportable = mock.Mock(exportable=True)
         not_exportable = mock.Mock(exportable=False)
         BE = export_tasks.BulkExport()
-        self.assertEqual(BE.filter_exportable([None, exportable, not_exportable]), [exportable])
+        self.assertEqual(
+            BE.filter_exportable([None, exportable, not_exportable]), [exportable])
 
     def test_bulk_export_filter_successful(self):
         BE = export_tasks.BulkExport()
-        self.assertEqual(BE.filter_successful(['foo', None, '0']), ['foo', '0'])
+        self.assertEqual(
+            BE.filter_successful(['foo', None, '0']), ['foo', '0'])
 
     def test_get_export_path(self):
         BE = export_tasks.BulkExport()
@@ -481,7 +500,8 @@ class TestExportTasks(unittest.TestCase):
         tasks = M.MonQTask.query.find(
             dict(task_name='allura.tasks.mail_tasks.sendmail')).all()
         assert_equal(len(tasks), 1)
-        assert_equal(tasks[0].kwargs['subject'], 'Bulk export for project test completed')
+        assert_equal(tasks[0].kwargs['subject'],
+                     'Bulk export for project test completed')
         assert_equal(tasks[0].kwargs['fromaddr'], 'noreply@sourceforge.net')
         assert_equal(tasks[0].kwargs['reply_to'], 'noreply@sourceforge.net')
         text = tasks[0].kwargs['text']

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index b8b5de7..4812cb7 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -36,6 +36,7 @@ from allura.lib import utils
 
 @patch.dict('allura.lib.utils.tg.config', clear=True, foo='bar', baz='true')
 class TestConfigProxy(unittest.TestCase):
+
     def setUp(self):
         self.cp = utils.ConfigProxy(mybaz="baz")
 
@@ -68,7 +69,8 @@ class TestChunkedIterator(unittest.TestCase):
         assert len(chunks[0]) == 2, chunks[0]
 
     def test_filter_on_sort_key(self):
-        query = {'username': {'$in': ['sample-user-1', 'sample-user-2', 'sample-user-3']}}
+        query = {'username':
+                 {'$in': ['sample-user-1', 'sample-user-2', 'sample-user-3']}}
         chunks = list(utils.chunked_find(M.User,
                                          query,
                                          2,
@@ -82,6 +84,7 @@ class TestChunkedIterator(unittest.TestCase):
 
 
 class TestChunkedList(unittest.TestCase):
+
     def test_chunked_list(self):
         l = range(10)
         chunks = list(utils.chunked_list(l, 3))
@@ -116,7 +119,7 @@ class TestAntispam(unittest.TestCase):
         self.assertRaises(
             ValueError,
             utils.AntiSpam.validate_request,
-            r, now=time.time()+24*60*60+1)
+            r, now=time.time() + 24 * 60 * 60 + 1)
 
     def test_invalid_future(self):
         form = dict(a='1', b='2')
@@ -124,7 +127,7 @@ class TestAntispam(unittest.TestCase):
         self.assertRaises(
             ValueError,
             utils.AntiSpam.validate_request,
-            r, now=time.time()-10)
+            r, now=time.time() - 10)
 
     def test_invalid_spinner(self):
         form = dict(a='1', b='2')
@@ -141,14 +144,16 @@ class TestAntispam(unittest.TestCase):
 
     def _encrypt_form(self, **kwargs):
         encrypted_form = dict(
-            (self.a.enc(k), v) for k,v in kwargs.items())
+            (self.a.enc(k), v) for k, v in kwargs.items())
         encrypted_form.setdefault(self.a.enc('honey0'), '')
         encrypted_form.setdefault(self.a.enc('honey1'), '')
         encrypted_form['spinner'] = self.a.spinner_text
         encrypted_form['timestamp'] = self.a.timestamp_text
         return encrypted_form
 
+
 class TestTruthyCallable(unittest.TestCase):
+
     def test_everything(self):
         def wrapper_func(bool_flag):
             def predicate(bool_flag=bool_flag):
@@ -184,6 +189,7 @@ class TestCaseInsensitiveDict(unittest.TestCase):
 
 
 class TestLineAnchorCodeHtmlFormatter(unittest.TestCase):
+
     def test_render(self):
         code = '#!/usr/bin/env python\n'\
                'print "Hello, world!"'
@@ -198,6 +204,7 @@ class TestLineAnchorCodeHtmlFormatter(unittest.TestCase):
 
 
 class TestIsTextFile(unittest.TestCase):
+
     def test_is_text_file(self):
         here_dir = path.dirname(__file__)
         assert utils.is_text_file(open(path.join(
@@ -216,7 +223,7 @@ class TestCodeStats(unittest.TestCase):
     def test_generate_code_stats(self):
         blob = Mock()
         blob.text = \
-"""class Person(object):
+            """class Person(object):
 
     def __init__(self, name='Alice'):
         self.name = name
@@ -231,6 +238,7 @@ class TestCodeStats(unittest.TestCase):
         assert stats['data_line_count'] == 5
         assert stats['code_size'] == len(blob.text)
 
+
 class TestHTMLSanitizer(unittest.TestCase):
 
     def test_html_sanitizer_iframe(self):
@@ -240,5 +248,7 @@ class TestHTMLSanitizer(unittest.TestCase):
 
     def test_html_sanitizer_youtube_iframe(self):
         p = utils.ForgeHTMLSanitizer('utf-8', '')
-        p.feed('<div><iframe src="http://www.youtube.com/embed/kOLpSPEA72U?feature=oembed"></iframe></div>')
-        assert_equal(p.output(),'<div><iframe src="http://www.youtube.com/embed/kOLpSPEA72U?feature=oembed"></iframe></div>')
+        p.feed(
+            '<div><iframe src="http://www.youtube.com/embed/kOLpSPEA72U?feature=oembed"></iframe></div>')
+        assert_equal(
+            p.output(), '<div><iframe src="http://www.youtube.com/embed/kOLpSPEA72U?feature=oembed"></iframe></div>')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_validators.py b/Allura/allura/tests/test_validators.py
index f3ba1ee..2e6bb02 100644
--- a/Allura/allura/tests/test_validators.py
+++ b/Allura/allura/tests/test_validators.py
@@ -50,6 +50,7 @@ class TestJsonFile(unittest.TestCase):
     val = v.JsonFile
 
     class FieldStorage(object):
+
         def __init__(self, content):
             self.value = content
 
@@ -65,6 +66,7 @@ class TestUserMapFile(unittest.TestCase):
     val = v.UserMapJsonFile()
 
     class FieldStorage(object):
+
         def __init__(self, content):
             self.value = content
 
@@ -86,7 +88,8 @@ class TestUserValidator(unittest.TestCase):
     val = v.UserValidator
 
     def test_valid(self):
-        self.assertEqual(M.User.by_username('root'), self.val.to_python('root'))
+        self.assertEqual(M.User.by_username('root'),
+                         self.val.to_python('root'))
 
     def test_invalid(self):
         with self.assertRaises(fe.Invalid) as cm:
@@ -158,7 +161,8 @@ class TestTaskValidator(unittest.TestCase):
     val = v.TaskValidator
 
     def test_valid(self):
-        self.assertEqual(dummy_task, self.val.to_python('allura.tests.test_validators.dummy_task'))
+        self.assertEqual(
+            dummy_task, self.val.to_python('allura.tests.test_validators.dummy_task'))
 
     def test_invalid_name(self):
         with self.assertRaises(fe.Invalid) as cm:
@@ -168,7 +172,8 @@ class TestTaskValidator(unittest.TestCase):
     def test_import_failure(self):
         with self.assertRaises(fe.Invalid) as cm:
             self.val.to_python('allura.does.not.exist')
-        self.assertEqual(str(cm.exception), 'Could not import "allura.does.not.exist"')
+        self.assertEqual(str(cm.exception),
+                         'Could not import "allura.does.not.exist"')
 
     def test_attr_lookup_failure(self):
         with self.assertRaises(fe.Invalid) as cm:
@@ -178,7 +183,8 @@ class TestTaskValidator(unittest.TestCase):
     def test_not_a_task(self):
         with self.assertRaises(fe.Invalid) as cm:
             self.val.to_python('allura.tests.test_validators.setUp')
-        self.assertEqual(str(cm.exception), '"allura.tests.test_validators.setUp" is not a task.')
+        self.assertEqual(str(cm.exception),
+                         '"allura.tests.test_validators.setUp" is not a task.')
 
 
 class TestPathValidator(unittest.TestCase):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/test_zarkov_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_zarkov_helpers.py b/Allura/allura/tests/test_zarkov_helpers.py
index 125aac0..36a14d4 100644
--- a/Allura/allura/tests/test_zarkov_helpers.py
+++ b/Allura/allura/tests/test_zarkov_helpers.py
@@ -26,6 +26,7 @@ import mock
 
 from allura.lib import zarkov_helpers as zh
 
+
 class TestZarkovClient(unittest.TestCase):
 
     def setUp(self):
@@ -33,9 +34,9 @@ class TestZarkovClient(unittest.TestCase):
         ctx = mock.Mock()
         self.socket = mock.Mock()
         ctx.socket = mock.Mock(return_value=self.socket)
-        PUSH=mock.Mock()
+        PUSH = mock.Mock()
         with mock.patch('allura.lib.zarkov_helpers.zmq') as zmq:
-            zmq.PUSH=PUSH
+            zmq.PUSH = PUSH
             zmq.Context.instance.return_value = ctx
             self.client = zh.ZarkovClient(addr)
         zmq.Context.instance.assert_called_once_with()
@@ -45,11 +46,12 @@ class TestZarkovClient(unittest.TestCase):
     def test_event(self):
         self.client.event('test', dict(user='testuser'))
         obj = bson.BSON.encode(dict(
-                type='test',
-                context=dict(user='testuser'),
-                extra=None))
+            type='test',
+            context=dict(user='testuser'),
+            extra=None))
         self.socket.send.assert_called_once_with(obj)
 
+
 class TestZeroFill(unittest.TestCase):
 
     def setUp(self):
@@ -61,11 +63,11 @@ class TestZeroFill(unittest.TestCase):
         self.ts_ms_end = ts_end * 1000.0
         self.zarkov_data = dict(
             a=dict(
-                a1=[ (self.ts_ms_begin, 1000), (self.ts_ms_end, 1000) ],
-                a2=[ (self.ts_ms_begin, 1000), (self.ts_ms_end, 1000) ] ),
+                a1=[(self.ts_ms_begin, 1000), (self.ts_ms_end, 1000)],
+                a2=[(self.ts_ms_begin, 1000), (self.ts_ms_end, 1000)]),
             b=dict(
-                b1=[ (self.ts_ms_begin, 2000), (self.ts_ms_end, 2000) ],
-                b2=[ (self.ts_ms_begin, 2000), (self.ts_ms_end, 2000) ] ))
+                b1=[(self.ts_ms_begin, 2000), (self.ts_ms_end, 2000)],
+                b2=[(self.ts_ms_begin, 2000), (self.ts_ms_end, 2000)]))
 
     def test_to_utc_timestamp(self):
         self.assertEqual(
@@ -86,9 +88,9 @@ class TestZeroFill(unittest.TestCase):
         self.assertEqual(result[-3][1], 1000)
         days_ms = 24 * 3600 * 1000
         min_delta = 28 * days_ms
-        max_delta= 31 * days_ms
+        max_delta = 31 * days_ms
         for p1, p2 in zip(result, result[1:]):
-            delta = p2[0]-p1[0]
+            delta = p2[0] - p1[0]
             assert min_delta <= delta <= max_delta, delta
 
     def test_zero_fill_time_series_date(self):
@@ -98,7 +100,7 @@ class TestZeroFill(unittest.TestCase):
         self.assertEqual(len(result), 489)
         days_ms = 24 * 3600 * 1000
         for p1, p2 in zip(result, result[1:]):
-            delta = p2[0]-p1[0]
+            delta = p2[0] - p1[0]
             assert delta == days_ms
 
     def test_zero_fill_zarkov_month_dt(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/unit/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/__init__.py b/Allura/allura/tests/unit/__init__.py
index 9e9e73d..27eb1e5 100644
--- a/Allura/allura/tests/unit/__init__.py
+++ b/Allura/allura/tests/unit/__init__.py
@@ -37,6 +37,7 @@ class MockPatchTestCase(object):
 
 
 class WithDatabase(MockPatchTestCase):
+
     def setUp(self):
         super(WithDatabase, self).setUp()
         clear_all_database_tables()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
index 520f691..e56f2bc 100644
--- a/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
+++ b/Allura/allura/tests/unit/controllers/test_discussion_moderation_controller.py
@@ -36,7 +36,7 @@ class TestWhenModerating(WithDatabase):
         super(TestWhenModerating, self).setUp()
         post = create_post('mypost')
         discussion_controller = Mock(
-            discussion = Mock(_id=post.discussion_id),
+            discussion=Mock(_id=post.discussion_id),
         )
         self.controller = ModerationController(discussion_controller)
 
@@ -45,7 +45,8 @@ class TestWhenModerating(WithDatabase):
         self.moderate_post(approve=True)
         post = self.get_post()
         assert_equal(post.status, 'ok')
-        assert_equal(post.thread.last_post_date.strftime("%Y-%m-%d %H:%M:%S"), mod_date.strftime("%Y-%m-%d %H:%M:%S"))
+        assert_equal(post.thread.last_post_date.strftime("%Y-%m-%d %H:%M:%S"),
+                     mod_date.strftime("%Y-%m-%d %H:%M:%S"))
 
     def test_that_it_can_mark_as_spam(self):
         self.moderate_post(spam=True)
@@ -56,8 +57,9 @@ class TestWhenModerating(WithDatabase):
         assert_equal(self.get_post(), None)
 
     def moderate_post(self, **kwargs):
-        self.controller.save_moderation(post=[dict(checked=True, _id=self.get_post()._id)],
-                                 **kwargs)
+        self.controller.save_moderation(
+            post=[dict(checked=True, _id=self.get_post()._id)],
+            **kwargs)
         ThreadLocalORMSession.flush_all()
 
     def get_post(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/unit/factories.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/factories.py b/Allura/allura/tests/unit/factories.py
index 20c33d1..6acb54f 100644
--- a/Allura/allura/tests/unit/factories.py
+++ b/Allura/allura/tests/unit/factories.py
@@ -66,7 +66,7 @@ def create_post(slug):
     author = create_user(username='someguy')
     return Post(slug=slug,
                 thread_id=thread._id,
-                full_slug='%s:%s' % (thread._id,slug),
+                full_slug='%s:%s' % (thread._id, slug),
                 discussion_id=discussion._id,
                 author_id=author._id)
 
@@ -84,4 +84,3 @@ def create_discussion():
 @flush_on_return
 def create_user(**kw):
     return User(**kw)
-

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/unit/patches.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/patches.py b/Allura/allura/tests/unit/patches.py
index 128d406..41cb403 100644
--- a/Allura/allura/tests/unit/patches.py
+++ b/Allura/allura/tests/unit/patches.py
@@ -50,4 +50,3 @@ def fake_redirect_patch(test_case):
 
 def fake_request_patch(test_case):
     return patch('allura.controllers.discuss.request')
-

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c93733ac/Allura/allura/tests/unit/spam/test_akismet.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/spam/test_akismet.py b/Allura/allura/tests/unit/spam/test_akismet.py
index 571eb92..1b7215a 100644
--- a/Allura/allura/tests/unit/spam/test_akismet.py
+++ b/Allura/allura/tests/unit/spam/test_akismet.py
@@ -27,9 +27,11 @@ from allura.lib.spam.akismetfilter import AKISMET_AVAILABLE, AkismetSpamFilter
 
 @unittest.skipIf(not AKISMET_AVAILABLE, "Akismet not available")
 class TestAkismet(unittest.TestCase):
+
     @mock.patch('allura.lib.spam.akismetfilter.akismet')
     def setUp(self, akismet_lib):
         self.akismet = AkismetSpamFilter({})
+
         def side_effect(*args, **kw):
             # side effect to test that data being sent to
             # akismet can be successfully urlencoded
@@ -37,7 +39,7 @@ class TestAkismet(unittest.TestCase):
         self.akismet.service.comment_check = mock.Mock(side_effect=side_effect)
         self.fake_artifact = mock.Mock(**{'url.return_value': 'artifact url'})
         self.fake_user = mock.Mock(display_name=u'Søme User',
-                email_addresses=['user@domain'])
+                                   email_addresses=['user@domain'])
         self.fake_headers = dict(
             REMOTE_ADDR='fallback ip',
             X_FORWARDED_FOR='some ip',
@@ -56,10 +58,11 @@ class TestAkismet(unittest.TestCase):
     def test_check(self, request, c):
         request.headers = self.fake_headers
         c.user = None
-        self.akismet.service.comment_check.side_effect({'side_effect':''})
+        self.akismet.service.comment_check.side_effect({'side_effect': ''})
         self.akismet.check(self.content)
-        self.akismet.service.comment_check.assert_called_once_with(self.content,
-                data=self.expected_data, build_data=False)
+        self.akismet.service.comment_check.assert_called_once_with(
+            self.content,
+            data=self.expected_data, build_data=False)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
     @mock.patch('allura.lib.spam.akismetfilter.request')
@@ -68,8 +71,9 @@ class TestAkismet(unittest.TestCase):
         c.user = None
         self.akismet.check(self.content, content_type='some content type')
         self.expected_data['comment_type'] = 'some content type'
-        self.akismet.service.comment_check.assert_called_once_with(self.content,
-                data=self.expected_data, build_data=False)
+        self.akismet.service.comment_check.assert_called_once_with(
+            self.content,
+            data=self.expected_data, build_data=False)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
     @mock.patch('allura.lib.spam.akismetfilter.request')
@@ -79,8 +83,9 @@ class TestAkismet(unittest.TestCase):
         self.akismet.check(self.content, artifact=self.fake_artifact)
         expected_data = self.expected_data
         expected_data['permalink'] = 'artifact url'
-        self.akismet.service.comment_check.assert_called_once_with(self.content,
-                data=expected_data, build_data=False)
+        self.akismet.service.comment_check.assert_called_once_with(
+            self.content,
+            data=expected_data, build_data=False)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
     @mock.patch('allura.lib.spam.akismetfilter.request')
@@ -90,9 +95,10 @@ class TestAkismet(unittest.TestCase):
         self.akismet.check(self.content, user=self.fake_user)
         expected_data = self.expected_data
         expected_data.update(comment_author=u'Søme User'.encode('utf8'),
-                comment_author_email='user@domain')
-        self.akismet.service.comment_check.assert_called_once_with(self.content,
-                data=expected_data, build_data=False)
+                             comment_author_email='user@domain')
+        self.akismet.service.comment_check.assert_called_once_with(
+            self.content,
+            data=expected_data, build_data=False)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
     @mock.patch('allura.lib.spam.akismetfilter.request')
@@ -102,9 +108,10 @@ class TestAkismet(unittest.TestCase):
         self.akismet.check(self.content)
         expected_data = self.expected_data
         expected_data.update(comment_author=u'Søme User'.encode('utf8'),
-                comment_author_email='user@domain')
-        self.akismet.service.comment_check.assert_called_once_with(self.content,
-                data=expected_data, build_data=False)
+                             comment_author_email='user@domain')
+        self.akismet.service.comment_check.assert_called_once_with(
+            self.content,
+            data=expected_data, build_data=False)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
     @mock.patch('allura.lib.spam.akismetfilter.request')
@@ -115,8 +122,9 @@ class TestAkismet(unittest.TestCase):
         request.remote_addr = self.fake_headers['REMOTE_ADDR']
         c.user = None
         self.akismet.check(self.content)
-        self.akismet.service.comment_check.assert_called_once_with(self.content,
-                data=self.expected_data, build_data=False)
+        self.akismet.service.comment_check.assert_called_once_with(
+            self.content,
+            data=self.expected_data, build_data=False)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
     @mock.patch('allura.lib.spam.akismetfilter.request')
@@ -124,7 +132,8 @@ class TestAkismet(unittest.TestCase):
         request.headers = self.fake_headers
         c.user = None
         self.akismet.submit_spam(self.content)
-        self.akismet.service.submit_spam.assert_called_once_with(self.content, data=self.expected_data, build_data=False)
+        self.akismet.service.submit_spam.assert_called_once_with(
+            self.content, data=self.expected_data, build_data=False)
 
     @mock.patch('allura.lib.spam.akismetfilter.c')
     @mock.patch('allura.lib.spam.akismetfilter.request')
@@ -132,4 +141,5 @@ class TestAkismet(unittest.TestCase):
         request.headers = self.fake_headers
         c.user = None
         self.akismet.submit_ham(self.content)
-        self.akismet.service.submit_ham.assert_called_once_with(self.content, data=self.expected_data, build_data=False)
+        self.akismet.service.submit_ham.assert_called_once_with(
+            self.content, data=self.expected_data, build_data=False)


Mime
View raw message