You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by rj...@apache.org on 2014/04/17 05:51:47 UTC

svn commit: r1588127 - in /bloodhound/trunk: bloodhound_relations/ bloodhound_relations/bhrelations/ bloodhound_relations/bhrelations/templates/ bloodhound_relations/bhrelations/tests/ bloodhound_relations/bhrelations/widgets/ bloodhound_search/bhsearc...

Author: rjollos
Date: Thu Apr 17 03:51:46 2014
New Revision: 1588127

URL: http://svn.apache.org/r1588127
Log:
0.8dev: PEP-0008 changes and fixed missing `id` tag.

Modified:
    bloodhound/trunk/bloodhound_relations/README
    bloodhound/trunk/bloodhound_relations/TESTING_README
    bloodhound/trunk/bloodhound_relations/bhrelations/api.py
    bloodhound/trunk/bloodhound_relations/bhrelations/db_default.py
    bloodhound/trunk/bloodhound_relations/bhrelations/model.py
    bloodhound/trunk/bloodhound_relations/bhrelations/notification.py
    bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html
    bloodhound/trunk/bloodhound_relations/bhrelations/tests/__init__.py
    bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py
    bloodhound/trunk/bloodhound_relations/bhrelations/tests/base.py
    bloodhound/trunk/bloodhound_relations/bhrelations/tests/mocks.py
    bloodhound/trunk/bloodhound_relations/bhrelations/tests/notification.py
    bloodhound/trunk/bloodhound_relations/bhrelations/tests/search.py
    bloodhound/trunk/bloodhound_relations/bhrelations/tests/validation.py
    bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py
    bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py
    bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py
    bloodhound/trunk/bloodhound_relations/setup.py
    bloodhound/trunk/bloodhound_search/bhsearch/tests/query_suggestion.py
    bloodhound/trunk/bloodhound_search/bhsearch/tests/security.py
    bloodhound/trunk/bloodhound_search/bhsearch/tests/web_ui.py
    bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py

Modified: bloodhound/trunk/bloodhound_relations/README
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/README?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/README (original)
+++ bloodhound/trunk/bloodhound_relations/README Thu Apr 17 03:51:46 2014
@@ -28,4 +28,4 @@ If you have any issues, please create a 
 
 == The Trac ticket-links branch
 Bloodhound Relations plugin contains the code from the Trac ticket-links branch, which
-is licensed under the same license as Trac (http://trac.edgewall.org/wiki/TracLicense).
\ No newline at end of file
+is licensed under the same license as Trac (http://trac.edgewall.org/wiki/TracLicense).

Modified: bloodhound/trunk/bloodhound_relations/TESTING_README
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/TESTING_README?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/TESTING_README (original)
+++ bloodhound/trunk/bloodhound_relations/TESTING_README Thu Apr 17 03:51:46 2014
@@ -1,5 +1,5 @@
 
-= Testing Bloodhound Search plugin =
+= Testing Bloodhound Relations plugin =
 
 == Overview ==
 

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/api.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/api.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/api.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/api.py Thu Apr 17 03:51:46 2014
@@ -16,30 +16,34 @@
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
-import itertools
 
+import itertools
 import re
 from datetime import datetime
 from pkg_resources import resource_filename
+
+from trac.config import OrderedExtensionsOption, Option
+from trac.core import Component, ExtensionPoint, Interface, TracError, \
+                      implements
+from trac.db import DatabaseManager
+from trac.env import IEnvironmentSetupParticipant
+from trac.resource import Neighborhood, Resource, ResourceNotFound, \
+                          ResourceSystem, get_resource_shortname
+from trac.ticket.api import ITicketChangeListener, ITicketManipulator, \
+                            TicketSystem
+from trac.ticket.model import Ticket
+from trac.util.datefmt import to_utimestamp, utc
+from trac.web.chrome import ITemplateProvider
+
+from multiproduct.api import ISupportMultiProductEnvironment
+from multiproduct.model import Product
+from multiproduct.env import ProductEnvironment
+
 from bhrelations import db_default
 from bhrelations.model import Relation
 from bhrelations.utils import unique
 from bhrelations.utils.translation import _, add_domain
-from multiproduct.api import ISupportMultiProductEnvironment
-from multiproduct.model import Product
-from multiproduct.env import ProductEnvironment
 
-from trac.config import OrderedExtensionsOption, Option
-from trac.core import (Component, implements, TracError, Interface,
-                       ExtensionPoint)
-from trac.env import IEnvironmentSetupParticipant
-from trac.db import DatabaseManager
-from trac.resource import (ResourceSystem, Resource, ResourceNotFound,
-                           get_resource_shortname, Neighborhood)
-from trac.ticket import Ticket, ITicketManipulator, ITicketChangeListener
-from trac.ticket.api import TicketSystem
-from trac.util.datefmt import utc, to_utimestamp
-from trac.web.chrome import ITemplateProvider
 
 PLUGIN_NAME = 'Bloodhound Relations Plugin'
 RELATIONS_CONFIG_NAME = 'bhrelations_links'
@@ -114,6 +118,8 @@ class EnvironmentSetup(Component):
     implements(IEnvironmentSetupParticipant, ISupportMultiProductEnvironment,
                ITemplateProvider)
 
+    # IEnvironmentSetupParticipant methods
+
     def environment_created(self):
         self.upgrade_environment(self.env.db_transaction)
 
@@ -123,10 +129,9 @@ class EnvironmentSetup(Component):
 
         db_version = db_default.DB_VERSION
         if db_installed_version > db_version:
-            raise TracError('''Current db version (%d) newer than supported by
-            this version of the %s (%d).''' % (db_installed_version,
-                                               PLUGIN_NAME,
-                                               db_version))
+            raise TracError("""Current db version (%d) newer than supported
+                            by this version of the %s (%d)."""
+                            % (db_installed_version, PLUGIN_NAME, db_version))
         needs_upgrade = db_installed_version < db_version or \
                         not list(self.config.options(RELATIONS_CONFIG_NAME))
         return needs_upgrade
@@ -149,25 +154,21 @@ class EnvironmentSetup(Component):
 
     def _get_version(self, db):
         """Finds the current version of the bloodhound database schema"""
-        rows = db("""
-            SELECT value FROM system WHERE name = %s
-            """, (db_default.DB_SYSTEM_KEY,))
+        rows = db("""SELECT value FROM system WHERE name = %s
+                  """, (db_default.DB_SYSTEM_KEY,))
         return int(rows[0][0]) if rows else -1
 
     def _update_db_version(self, db, version):
         old_version = self._get_version(db)
         if old_version != -1:
-            self.log.info(
-                "Updating %s database schema from version %d to %d",
-                PLUGIN_NAME, old_version, version)
+            self.log.info("Updating %s database schema from version %d to %d",
+                          PLUGIN_NAME, old_version, version)
             db("""UPDATE system SET value=%s
-                      WHERE name=%s""", (version, db_default.DB_SYSTEM_KEY))
+                  WHERE name=%s""", (version, db_default.DB_SYSTEM_KEY))
         else:
-            self.log.info(
-                "Initial %s database schema set to version %d",
-                PLUGIN_NAME, version)
-            db("""
-                INSERT INTO system (name, value) VALUES ('%s','%s')
+            self.log.info("Initial %s database schema set to version %d",
+                          PLUGIN_NAME, version)
+            db("""INSERT INTO system (name, value) VALUES ('%s','%s')
                 """ % (db_default.DB_SYSTEM_KEY, version))
         return version
 
@@ -180,6 +181,7 @@ class EnvironmentSetup(Component):
                 db(statement)
 
     # ITemplateProviderMethods
+
     def get_templates_dirs(self):
         """provide the plugin templates"""
         return [resource_filename(__name__, 'templates')]
@@ -457,9 +459,9 @@ class ResourceIdSerializer(object):
         * resource_full_id: fully qualified resource id in format
         "product:ticket:123". In case of global environment it is ":ticket:123"
         """
-        nbhprefix, realm, resource_id = cls.split_full_id(resource_full_id)
-        if nbhprefix:
-            neighborhood = Neighborhood('product', nbhprefix)
+        nbh_prefix, realm, resource_id = cls.split_full_id(resource_full_id)
+        if nbh_prefix:
+            neighborhood = Neighborhood('product', nbh_prefix)
             return neighborhood.child(realm, id=resource_id)
         else:
             return Resource(realm, id=resource_id)
@@ -483,10 +485,10 @@ class ResourceIdSerializer(object):
         if ticket.id is None:
             raise ValueError("Cannot get resource id for ticket "
                              "that does not exist yet.")
-        nbhprefix = ticket["product"]
+        nbh_prefix = ticket["product"]
 
         resource_full_id = cls.RESOURCE_ID_DELIMITER.join(
-            (nbhprefix, resource.realm, unicode(resource.id))
+            (nbh_prefix, resource.realm, unicode(resource.id))
         )
         return resource_full_id
 
@@ -504,7 +506,7 @@ class TicketRelationsSpecifics(Component
     def ticket_changed(self, ticket, comment, author, old_values):
         if self._closed_as_duplicate(ticket) and \
                 self.rls.duplicate_relation_type and \
-                hasattr(ticket, 'duplicate'): # workaround for comment:5:ticket:710
+                hasattr(ticket, 'duplicate'):  # workaround for comment:5:ticket:710
             try:
                 self.rls.add(ticket, ticket.duplicate,
                              self.rls.duplicate_relation_type,
@@ -604,7 +606,8 @@ class TicketRelationsSpecifics(Component
                     for p in Product.select(self.env):
                         if p.prefix != self.env.product.prefix:
                             # TODO: check for PRODUCT_VIEW permissions
-                            penv = ProductEnvironment(self.env.parent, p.prefix)
+                            penv = ProductEnvironment(self.env.parent,
+                                                      p.prefix)
                             try:
                                 ticket = Ticket(penv, tid)
                             except ResourceNotFound:
@@ -637,8 +640,8 @@ class TicketRelationsSpecifics(Component
 
     def _get_env_for_resource(self, resource):
         if hasattr(resource, "neighborhood"):
-            env = ResourceSystem(self.env).load_component_manager(
-                resource.neighborhood)
+            env = ResourceSystem(self.env). \
+                    load_component_manager(resource.neighborhood)
         else:
             env = self.env
         return env
@@ -677,12 +680,12 @@ class TicketChangeRecordUpdater(Componen
                 )
 
     def _get_ticket_id_and_product(self, resource_full_id):
-        nbhprefix, realm, resource_id = ResourceIdSerializer.split_full_id(
-            resource_full_id)
+        nbh_prefix, realm, resource_id = \
+            ResourceIdSerializer.split_full_id(resource_full_id)
         ticket_id = None
         if realm == "ticket":
             ticket_id = int(resource_id)
-        return ticket_id, nbhprefix
+        return ticket_id, nbh_prefix
 
     def _add_ticket_change_record(
             self, db, relation, relation_system, is_delete, when_ts):

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/db_default.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/db_default.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/db_default.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/db_default.py Thu Apr 17 03:51:46 2014
@@ -16,6 +16,7 @@
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
 from bhrelations.model import Relation
 
 DB_SYSTEM_KEY = 'bhrelations'

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/model.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/model.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/model.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/model.py Thu Apr 17 03:51:46 2014
@@ -17,10 +17,11 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-from bhdashboard.model import ModelBase
 from trac.resource import Resource
 from trac.util.datefmt import to_utimestamp, from_utimestamp
 
+from bhdashboard.model import ModelBase
+
 
 class Relation(ModelBase):
     """The Relation table"""

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/notification.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/notification.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/notification.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/notification.py Thu Apr 17 03:51:46 2014
@@ -16,9 +16,10 @@
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
 from trac.notification import NotifyEmail
-from trac.ticket.notification import (get_ticket_notification_recipients,
-                                      TicketNotifyEmail)
+from trac.ticket.notification import TicketNotifyEmail, \
+                                     get_ticket_notification_recipients
 from trac.util.datefmt import from_utimestamp
 from trac.web.chrome import Chrome
 
@@ -67,7 +68,7 @@ class RelationNotifyEmail(TicketNotifyEm
         to, cc = [], []
         for resource in (source, destination):
             if resource.realm == 'ticket':
-                (torecipients, ccrecipients, reporter, owner) = \
+                torecipients, ccrecipients, reporter, owner = \
                     get_ticket_notification_recipients(self.env, self.config,
                     resource.id, [])
                 to.extend(torecipients)

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/templates/relations_manage.html Thu Apr 17 03:51:46 2014
@@ -70,7 +70,7 @@
           <div class="control-group">
             <label class="control-label" for="comment">Comment</label>
             <div class="controls">
-              <textarea name="comment" rows="3" class="span4">${relation.comment}</textarea>
+              <textarea id="comment" name="comment" rows="3" class="span4">${relation.comment}</textarea>
             </div>
           </div>
 
@@ -127,4 +127,3 @@
     </div>
   </body>
 </html>
-

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/__init__.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/__init__.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/tests/__init__.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/__init__.py Thu Apr 17 03:51:46 2014
@@ -17,11 +17,6 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-# import sys
-# if sys.version < (2, 7):
-#     import unittest2 as unittest
-# else:
-#     import unittest
 import unittest
 
 from bhrelations.tests import api, notification, search, validation, web_ui
@@ -36,6 +31,7 @@ def suite():
     test_suite.addTest(web_ui.suite())
     return test_suite
 
+
 if __name__ == '__main__':
     unittest.main(defaultTest='suite')
 else:

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py Thu Apr 17 03:51:46 2014
@@ -16,19 +16,23 @@
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
-from datetime import datetime
+
 import unittest
+from datetime import datetime
+
+from trac.core import TracError
+from trac.ticket.model import Ticket
+from trac.util.datefmt import utc
+
+from multiproduct.env import ProductEnvironment
 
 from bhrelations.api import TicketRelationsSpecifics
 from bhrelations.tests.mocks import TestRelationChangingListener
 from bhrelations.validation import ValidationError
-from bhrelations.tests.base import BaseRelationsTestCase, PARENT, CHILD, \
-    DEPENDS_ON, DEPENDENCY_OF, BLOCKS, BLOCKED_BY, REFERS_TO, DUPLICATE_OF, \
-    MULTIPRODUCT_REL
-from multiproduct.env import ProductEnvironment
-from trac.ticket.model import Ticket
-from trac.core import TracError
-from trac.util.datefmt import utc
+from bhrelations.tests.base import BaseRelationsTestCase, BLOCKED_BY, \
+                                   BLOCKS, CHILD, DEPENDENCY_OF, DEPENDS_ON, \
+                                   DUPLICATE_OF, MULTIPRODUCT_REL, PARENT, \
+                                   REFERS_TO
 
 
 class ApiTestCase(BaseRelationsTestCase):
@@ -364,9 +368,9 @@ class ApiTestCase(BaseRelationsTestCase)
 
     def test_cannot_create_other_relations_between_descendants(self):
         t1, t2, t3, t4, t5 = map(self._insert_and_load_ticket, "12345")
-        self.add_relation(t1, PARENT, t2)  #    t1 -> t2
-        self.add_relation(t2, PARENT, t3)  #         /  \
-        self.add_relation(t2, PARENT, t4)  #       t3    t4
+        self.add_relation(t1, PARENT, t2)   #    t1 -> t2
+        self.add_relation(t2, PARENT, t3)   #         /  \
+        self.add_relation(t2, PARENT, t4)   #       t3    t4
 
         self.assertRaises(
             ValidationError,
@@ -396,9 +400,9 @@ class ApiTestCase(BaseRelationsTestCase)
 
     def test_cannot_add_parent_if_this_would_cause_invalid_relations(self):
         t1, t2, t3, t4, t5 = map(self._insert_and_load_ticket, "12345")
-        self.add_relation(t1, PARENT, t2)  #    t1 -> t2
-        self.add_relation(t2, PARENT, t3)  #         /  \
-        self.add_relation(t2, PARENT, t4)  #       t3    t4    t5
+        self.add_relation(t1, PARENT, t2)   #    t1 -> t2
+        self.add_relation(t2, PARENT, t3)   #         /  \
+        self.add_relation(t2, PARENT, t4)   #       t3    t4    t5
         self.add_relation(t2, DEPENDS_ON, t5)
 
         self.assertRaises(
@@ -422,9 +426,9 @@ class ApiTestCase(BaseRelationsTestCase)
             self.fail("Could not add valid relation.")
 
     def test_cannot_close_ticket_with_open_children(self):
-        t1 = self._insert_and_load_ticket("1")  #     t1
-        t2 = self._insert_and_load_ticket("2", status='closed')  #   /  | \
-        t3 = self._insert_and_load_ticket("3")  #  t2 t3 t4
+        t1 = self._insert_and_load_ticket("1")                    #     t1
+        t2 = self._insert_and_load_ticket("2", status='closed')   #   /  |  \
+        t3 = self._insert_and_load_ticket("3")                    #  t2 t3  t4
         t4 = self._insert_and_load_ticket("4")
         self.add_relation(t1, PARENT, t2)
         self.add_relation(t1, PARENT, t3)
@@ -599,7 +603,7 @@ class TicketChangeRecordUpdaterTestCase(
 
         if ticket_id:
             sql = """SELECT time, author, field, oldvalue, newvalue
-                    FROM ticket_change WHERE ticket=%s"""
+                     FROM ticket_change WHERE ticket=%s"""
             print "db_transaction select by ticket_id result:"
             with self.env.db_transaction:
                 for row in self.env.db_query(sql, (ticket_id, )):
@@ -608,11 +612,9 @@ class TicketChangeRecordUpdaterTestCase(
 
 def suite():
     test_suite = unittest.TestSuite()
-    test_suite.addTest(unittest.makeSuite(ApiTestCase, 'test'))
-    test_suite.addTest(unittest.makeSuite(
-        RelationChangingListenerTestCase, 'test'))
-    test_suite.addTest(unittest.makeSuite(
-        TicketChangeRecordUpdaterTestCase, 'test'))
+    test_suite.addTest(unittest.makeSuite(ApiTestCase))
+    test_suite.addTest(unittest.makeSuite(RelationChangingListenerTestCase))
+    test_suite.addTest(unittest.makeSuite(TicketChangeRecordUpdaterTestCase))
     return test_suite
 
 

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/base.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/base.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/tests/base.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/base.py Thu Apr 17 03:51:46 2014
@@ -18,16 +18,17 @@
 #  under the License.
 
 from tests.env import MultiproductTestCase
-from multiproduct.env import ProductEnvironment
-from bhrelations.api import RelationsSystem, EnvironmentSetup, \
-    RELATIONS_CONFIG_NAME
 from trac.test import EnvironmentStub, Mock, MockPerm
 from trac.ticket import Ticket
 from trac.util.datefmt import utc
 
+from multiproduct.env import ProductEnvironment
+
+from bhrelations.api import EnvironmentSetup, RelationsSystem, \
+                            RELATIONS_CONFIG_NAME
+
 try:
     from babel import Locale
-
     locale_en = Locale.parse('en_US')
 except ImportError:
     locale_en = None
@@ -124,7 +125,8 @@ class BaseRelationsTestCase(Multiproduct
         return Ticket(env, self._insert_ticket(env, summary, **kw))
 
     def add_relation(self, source, reltype, destination, *args, **kwargs):
-        return self.relations_system.add(source, destination, reltype, *args, **kwargs)
+        return self.relations_system.add(source, destination, reltype,
+                                         *args, **kwargs)
 
     def get_relations(self, ticket):
         return self.relations_system.get_relations(ticket)

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/mocks.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/mocks.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/tests/mocks.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/mocks.py Thu Apr 17 03:51:46 2014
@@ -16,9 +16,11 @@
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
-from bhrelations.api import IRelationChangingListener
+
 from trac.core import Component, implements
 
+from bhrelations.api import IRelationChangingListener
+
 
 class TestRelationChangingListener(Component):
     implements(IRelationChangingListener)

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/notification.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/notification.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/tests/notification.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/notification.py Thu Apr 17 03:51:46 2014
@@ -16,15 +16,18 @@
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
 import unittest
+
 from trac.tests.notification import SMTPServerStore, SMTPThreadedServer
-from trac.ticket.tests.notification import (
-    SMTP_TEST_PORT, smtp_address, parse_smtp_message)
-from bhrelations.tests.base import BaseRelationsTestCase, DEPENDENCY_OF
+from trac.ticket.tests.notification import SMTP_TEST_PORT, smtp_address
+
+from bhrelations.tests.base import DEPENDENCY_OF, BaseRelationsTestCase
 from bhrelations.notification import RelationNotifyEmail
 
 
 class NotificationTestCase(BaseRelationsTestCase):
+
     @classmethod
     def setUpClass(cls):
         cls.smtpd = CustomSMTPThreadedServer(SMTP_TEST_PORT)
@@ -54,7 +57,7 @@ class NotificationTestCase(BaseRelations
         """To/Cc recipients"""
         ticket = self._insert_and_load_ticket(
             'Foo',
-            reporter= '"Joe User" < joe.user@example.org >',
+            reporter='"Joe User" < joe.user@example.org >',
             owner='joe.user@example.net',
             cc='joe.user@example.com, joe.bar@example.org, '
                'joe.bar@example.net'
@@ -150,8 +153,9 @@ class CustomSMTPThreadedServer(SMTPThrea
 
 def suite():
     test_suite = unittest.TestSuite()
-    test_suite.addTest(unittest.makeSuite(NotificationTestCase, 'test'))
+    test_suite.addTest(unittest.makeSuite(NotificationTestCase))
     return test_suite
 
+
 if __name__ == '__main__':
     unittest.main()

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/search.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/search.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/tests/search.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/search.py Thu Apr 17 03:51:46 2014
@@ -16,6 +16,7 @@
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
 import shutil
 import tempfile
 import unittest
@@ -24,12 +25,13 @@ from bhsearch.api import BloodhoundSearc
 
 # TODO: Figure how to get trac to load components from these modules
 import bhsearch.query_parser, bhsearch.search_resources.ticket_search, \
-    bhsearch.whoosh_backend
+       bhsearch.whoosh_backend
 import bhrelations.search
 from bhrelations.tests.base import BaseRelationsTestCase, DEPENDENCY_OF
 
 
 class SearchIntegrationTestCase(BaseRelationsTestCase):
+
     def setUp(self):
         BaseRelationsTestCase.setUp(self, enabled=['bhsearch.*'])
         self.global_env.path = tempfile.mkdtemp('bhrelations-tempenv')
@@ -66,14 +68,17 @@ class SearchIntegrationTestCase(BaseRela
 
         self.add_relation(t1, DEPENDENCY_OF, t2)
 
-        self.assertEqual(self.search_api.query('%s:#2' % DEPENDENCY_OF).hits, 1)
-        self.assertEqual(self.search_api.query('%s:#tp1-2' % DEPENDENCY_OF).hits, 1)
+        self.assertEqual(self.search_api.query('%s:#2'
+                                               % DEPENDENCY_OF).hits, 1)
+        self.assertEqual(self.search_api.query('%s:#tp1-2'
+                                               % DEPENDENCY_OF).hits, 1)
 
 
 def suite():
     test_suite = unittest.TestSuite()
-    test_suite.addTest(unittest.makeSuite(SearchIntegrationTestCase, 'test'))
+    test_suite.addTest(unittest.makeSuite(SearchIntegrationTestCase))
     return test_suite
 
+
 if __name__ == '__main__':
     unittest.main()

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/validation.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/validation.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/tests/validation.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/validation.py Thu Apr 17 03:51:46 2014
@@ -16,10 +16,11 @@
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
 import unittest
 
-from bhrelations.validation import Validator
 from bhrelations.tests.base import BaseRelationsTestCase
+from bhrelations.validation import Validator
 
 
 class GraphFunctionsTestCase(BaseRelationsTestCase):
@@ -45,55 +46,34 @@ class GraphFunctionsTestCase(BaseRelatio
         self.validator = Validator(self.env)
 
     def test_find_path(self):
-        self.assertEqual(
-            self.validator._find_path(u'A', u'E', u'p'),
-            [u'A', u'C', u'E'])
-        self.assertEqual(
-            self.validator._find_path(u'A', u'G', u'p'),
-            [u'A', u'C', u'E', u'F', u'G'])
-        self.assertEqual(
-            self.validator._find_path(u'H', u'D', u'p'),
-            [u'H', u'C', u'D'])
-        self.assertEqual(
-            self.validator._find_path(u'E', u'A', u'p'),
-            None)
-        self.assertEqual(
-            self.validator._find_path(u'B', u'D', u'p'),
-            None)
+        self.assertEqual(self.validator._find_path(u'A', u'E', u'p'),
+                         [u'A', u'C', u'E'])
+        self.assertEqual(self.validator._find_path(u'A', u'G', u'p'),
+                         [u'A', u'C', u'E', u'F', u'G'])
+        self.assertEqual(self.validator._find_path(u'H', u'D', u'p'),
+                         [u'H', u'C', u'D'])
+        self.assertEqual(self.validator._find_path(u'E', u'A', u'p'), None)
+        self.assertEqual(self.validator._find_path(u'B', u'D', u'p'), None)
 
     def test_descendants(self):
-        self.assertEqual(
-            self.validator._descendants(u'B', u'p'),
-            set()
-        )
-        self.assertEqual(
-            self.validator._descendants(u'E', u'p'),
-            set([u'F', u'G'])
-        )
-        self.assertEqual(
-            self.validator._descendants(u'H', u'p'),
-            set([u'C', u'D', u'E', u'F', u'G'])
-        )
+        self.assertEqual(self.validator._descendants(u'B', u'p'), set())
+        self.assertEqual(self.validator._descendants(u'E', u'p'),
+                         set([u'F', u'G']))
+        self.assertEqual(self.validator._descendants(u'H', u'p'),
+                         set([u'C', u'D', u'E', u'F', u'G']))
 
     def test_ancestors(self):
-        self.assertEqual(
-            self.validator._ancestors(u'B', u'p'),
-            set([u'A'])
-        )
-        self.assertEqual(
-            self.validator._ancestors(u'E', u'p'),
-            set([u'A', u'C', u'H'])
-        )
-        self.assertEqual(
-            self.validator._ancestors(u'H', u'p'),
-            set()
-        )
+        self.assertEqual(self.validator._ancestors(u'B', u'p'), set([u'A']))
+        self.assertEqual(self.validator._ancestors(u'E', u'p'),
+                         set([u'A', u'C', u'H']))
+        self.assertEqual(self.validator._ancestors(u'H', u'p'), set())
 
 
 def suite():
     test_suite = unittest.TestSuite()
-    test_suite.addTest(unittest.makeSuite(GraphFunctionsTestCase, 'test'))
+    test_suite.addTest(unittest.makeSuite(GraphFunctionsTestCase))
     return test_suite
 
+
 if __name__ == '__main__':
     unittest.main()

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py Thu Apr 17 03:51:46 2014
@@ -16,19 +16,23 @@
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
 import unittest
-from bhrelations.api import ResourceIdSerializer
-from bhrelations.web_ui import RelationManagementModule
-from bhrelations.tests.base import BaseRelationsTestCase,\
-    DEPENDS_ON, DUPLICATE_OF
 
-from multiproduct.ticket.web_ui import TicketModule
 from trac.ticket import Ticket
 from trac.util.datefmt import to_utimestamp
 from trac.web import RequestDone
 
+from bhrelations.api import ResourceIdSerializer
+from bhrelations.tests.base import DEPENDS_ON, DUPLICATE_OF, \
+                                   BaseRelationsTestCase
+from bhrelations.web_ui import RelationManagementModule
+
+from multiproduct.ticket.web_ui import TicketModule
+
 
 class RelationManagementModuleTestCase(BaseRelationsTestCase):
+
     def setUp(self):
         BaseRelationsTestCase.setUp(self)
         ticket_id = self._insert_ticket(self.env, "Foo")
@@ -94,7 +98,7 @@ class RelationManagementModuleTestCase(B
         rlm = RelationManagementModule(self.env)
         rlm.notify_relation_changed = self._failing_notification
 
-        url, data, x = rlm.process_request(self.req)
+        rlm.process_request(self.req)
         self.assertEqual(len(self.req.chrome['warnings']), 1)
 
     def _failing_notification(self, relation):
@@ -107,6 +111,7 @@ class RelationManagementModuleTestCase(B
 
 
 class ResolveTicketIntegrationTestCase(BaseRelationsTestCase):
+
     def setUp(self):
         BaseRelationsTestCase.setUp(self)
 
@@ -165,8 +170,8 @@ class ResolveTicketIntegrationTestCase(B
 
     def test_post_process_request_can_handle_none_data(self):
         self.req.path_info = '/source'
-        RelationManagementModule(self.env).post_process_request(
-            self.req, '', None, '')
+        RelationManagementModule(self.env).post_process_request(self.req, '',
+                                                                None, '')
 
     def resolve_as_duplicate(self, ticket, duplicate_id):
         self.req.method = 'POST'
@@ -219,8 +224,9 @@ class ResolveTicketIntegrationTestCase(B
 
 def suite():
     test_suite = unittest.TestSuite()
-    test_suite.addTest(unittest.makeSuite(RelationManagementModuleTestCase, 'test'))
+    test_suite.addTest(unittest.makeSuite(RelationManagementModuleTestCase))
     return test_suite
 
+
 if __name__ == '__main__':
     unittest.main()

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py Thu Apr 17 03:51:46 2014
@@ -46,6 +46,7 @@ class RelationManagementModule(Component
     implements(IRequestFilter, IRequestHandler, ITemplateProvider)
 
     # IRequestHandler methods
+
     def match_request(self, req):
         match = re.match(r'/ticket/([0-9]+)/relations/*$', req.path_info)
         if not match:
@@ -139,6 +140,7 @@ class RelationManagementModule(Component
         RelationNotifyEmail(self.env).notify(relation)
 
     # ITemplateProvider methods
+
     def get_htdocs_dirs(self):
         return []
 
@@ -147,6 +149,7 @@ class RelationManagementModule(Component
         return [resource_filename('bhrelations', 'templates')]
 
     # IRequestFilter methods
+
     def pre_process_request(self, req, handler):
         return handler
 
@@ -168,7 +171,8 @@ class RelationManagementModule(Component
                         duplicate_relations[0].destination
         return template, data, content_type
 
-    # utility functions
+    # Public methods
+
     def get_ticket_relations(self, ticket):
         grouped_relations = {}
         relsys = RelationsSystem(self.env)

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/widgets/relations.py Thu Apr 17 03:51:46 2014
@@ -42,23 +42,22 @@ class TicketRelationsWidget(WidgetBase):
         the widget with specified name.
         """
         return {
-                'tid' : {
-                        'desc' : """Source ticket id""",
-                        'type' : int
-                    },
+                'tid': {
+                    'desc': """Source ticket id""",
+                    'type': int
+                },
 
-                'max' : {
-                        'desc' : """Limit the number of relations displayed""",
-                        'type' : int
-                    },
-            }
+                'max': {
+                    'desc': """Limit the number of relations displayed""",
+                    'type': int
+                },
+        }
 
     get_widget_params = pretty_wrapper(get_widget_params, check_widget_name)
 
     def render_widget(self, name, context, options):
         """Gather list of relations and render data in compact view
         """
-        req = context.req
         title = _('Related tickets')
         params = ('tid', 'max')
         tid, max_ = self.bind_params(name, options, *params)
@@ -71,7 +70,9 @@ class TicketRelationsWidget(WidgetBase):
             'get_resource_shortname': get_resource_shortname,
             'get_resource_summary': get_resource_summary,
         }
-        return 'widget_relations.html', \
-            {'title': title, 'data': data, }, context
+        return 'widget_relations.html', {
+            'title': title,
+            'data': data,
+        }, context
 
     render_widget = pretty_wrapper(render_widget, check_widget_name)

Modified: bloodhound/trunk/bloodhound_relations/setup.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/setup.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/setup.py (original)
+++ bloodhound/trunk/bloodhound_relations/setup.py Thu Apr 17 03:51:46 2014
@@ -41,14 +41,14 @@ versions = [
 latest = '.'.join(str(x) for x in versions[-1])
 
 status = {
-            'planning' :  "Development Status :: 1 - Planning",
-            'pre-alpha' : "Development Status :: 2 - Pre-Alpha",
-            'alpha' :     "Development Status :: 3 - Alpha",
-            'beta' :      "Development Status :: 4 - Beta",
-            'stable' :    "Development Status :: 5 - Production/Stable",
-            'mature' :    "Development Status :: 6 - Mature",
-            'inactive' :  "Development Status :: 7 - Inactive"
-         }
+    'planning' :  "Development Status :: 1 - Planning",
+    'pre-alpha' : "Development Status :: 2 - Pre-Alpha",
+    'alpha' :     "Development Status :: 3 - Alpha",
+    'beta' :      "Development Status :: 4 - Beta",
+    'stable' :    "Development Status :: 5 - Production/Stable",
+    'mature' :    "Development Status :: 6 - Mature",
+    'inactive' :  "Development Status :: 7 - Inactive"
+    }
 dev_status = status["alpha"]
 
 cats = [

Modified: bloodhound/trunk/bloodhound_search/bhsearch/tests/query_suggestion.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_search/bhsearch/tests/query_suggestion.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_search/bhsearch/tests/query_suggestion.py (original)
+++ bloodhound/trunk/bloodhound_search/bhsearch/tests/query_suggestion.py Thu Apr 17 03:51:46 2014
@@ -84,7 +84,7 @@ class QuerySuggestionTestCase(BaseBloodh
 
 def suite():
     test_suite = unittest.TestSuite()
-    test_suite.addTest(unittest.makeSuite(QuerySuggestionTestCase, 'test'))
+    test_suite.addTest(unittest.makeSuite(QuerySuggestionTestCase))
     return test_suite
 
 if __name__ == '__main__':

Modified: bloodhound/trunk/bloodhound_search/bhsearch/tests/security.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_search/bhsearch/tests/security.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_search/bhsearch/tests/security.py (original)
+++ bloodhound/trunk/bloodhound_search/bhsearch/tests/security.py Thu Apr 17 03:51:46 2014
@@ -392,10 +392,10 @@ class SecurityFilterTests(unittest.TestC
 
 def suite():
     suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(MultiProductSecurityTestCase, 'test'))
+    suite.addTest(unittest.makeSuite(MultiProductSecurityTestCase))
     if configobj:
-        suite.addTest(unittest.makeSuite(AuthzSecurityTestCase, 'test'))
-    suite.addTest(unittest.makeSuite(SecurityFilterTests, 'test'))
+        suite.addTest(unittest.makeSuite(AuthzSecurityTestCase))
+    suite.addTest(unittest.makeSuite(SecurityFilterTests))
     return suite
 
 if __name__ == '__main__':

Modified: bloodhound/trunk/bloodhound_search/bhsearch/tests/web_ui.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_search/bhsearch/tests/web_ui.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_search/bhsearch/tests/web_ui.py (original)
+++ bloodhound/trunk/bloodhound_search/bhsearch/tests/web_ui.py Thu Apr 17 03:51:46 2014
@@ -909,8 +909,8 @@ class RequestParametersTest(unittest.Tes
 
 def suite():
     test_suite = unittest.TestSuite()
-    test_suite.addTest(unittest.makeSuite(WebUiTestCaseWithWhoosh, 'test'))
-    test_suite.addTest(unittest.makeSuite(RequestParametersTest, 'test'))
+    test_suite.addTest(unittest.makeSuite(WebUiTestCaseWithWhoosh))
+    test_suite.addTest(unittest.makeSuite(RequestParametersTest))
     return test_suite
 
 if __name__ == '__main__':

Modified: bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py?rev=1588127&r1=1588126&r2=1588127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py (original)
+++ bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py Thu Apr 17 03:51:46 2014
@@ -565,8 +565,8 @@ class WhooshFunctionalityTestCase(unitte
 
 def suite():
     test_suite = unittest.TestSuite()
-    test_suite.addTest(unittest.makeSuite(WhooshBackendTestCase, 'test'))
-    test_suite.addTest(unittest.makeSuite(WhooshFunctionalityTestCase, 'test'))
+    test_suite.addTest(unittest.makeSuite(WhooshBackendTestCase))
+    test_suite.addTest(unittest.makeSuite(WhooshFunctionalityTestCase))
     return test_suite
 
 if __name__ == '__main__':