1. Olemis Lang
  2. bloodhound-tlp

Commits

rjo...@13f79535-47bb-0310-9956-ffa450edef68  committed 38f24fd Draft

0.8dev: PEP-0008 changes and fixed missing `id` tag.

  • Participants
  • Parent commits 56532fa
  • Branches default

Comments (0)

Files changed (22)

File bloodhound_relations/README

View file
 
 == 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).
+is licensed under the same license as Trac (http://trac.edgewall.org/wiki/TracLicense).

File bloodhound_relations/TESTING_README

View file
 
-= Testing Bloodhound Search plugin =
+= Testing Bloodhound Relations plugin =
 
 == Overview ==
 

File bloodhound_relations/bhrelations/api.py

View file
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
 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'
     implements(IEnvironmentSetupParticipant, ISupportMultiProductEnvironment,
                ITemplateProvider)
 
+    # IEnvironmentSetupParticipant methods
+
     def environment_created(self):
         self.upgrade_environment(self.env.db_transaction)
 
 
         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
 
     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
 
                 db(statement)
 
     # ITemplateProviderMethods
+
     def get_templates_dirs(self):
         """provide the plugin templates"""
         return [resource_filename(__name__, 'templates')]
         * 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)
         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
 
     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,
                     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:
 
     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
                 )
 
     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):

File bloodhound_relations/bhrelations/db_default.py

View file
 #  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'

File bloodhound_relations/bhrelations/model.py

View file
 #  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"""

File bloodhound_relations/bhrelations/notification.py

View file
 #  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
 
         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)

File bloodhound_relations/bhrelations/templates/relations_manage.html

View file
           <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>
 
     </div>
   </body>
 </html>
-

File bloodhound_relations/bhrelations/tests/__init__.py

View file
 #  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
     test_suite.addTest(web_ui.suite())
     return test_suite
 
+
 if __name__ == '__main__':
     unittest.main(defaultTest='suite')
 else:

File bloodhound_relations/bhrelations/tests/api.py

View file
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
+import unittest
 from datetime import datetime
-import unittest
+
+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):
 
     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,
 
     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(
             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)
 
         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, )):
 
 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
 
 

File bloodhound_relations/bhrelations/tests/base.py

View file
 #  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
         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)

File bloodhound_relations/bhrelations/tests/mocks.py

View file
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
+from trac.core import Component, implements
+
 from bhrelations.api import IRelationChangingListener
-from trac.core import Component, implements
 
 
 class TestRelationChangingListener(Component):

File bloodhound_relations/bhrelations/tests/notification.py

View file
 #  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)
         """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'
 
 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()

File bloodhound_relations/bhrelations/tests/search.py

View file
 #  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
 
 # 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')
 
         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()

File bloodhound_relations/bhrelations/tests/validation.py

View file
 #  KIND, either express or implied.  See the License for the
 #  specific language governing permissions and limitations
 #  under the License.
+
 import unittest
 
+from bhrelations.tests.base import BaseRelationsTestCase
 from bhrelations.validation import Validator
-from bhrelations.tests.base import BaseRelationsTestCase
 
 
 class GraphFunctionsTestCase(BaseRelationsTestCase):
         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()

File bloodhound_relations/bhrelations/tests/web_ui.py

View file
 #  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")
         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):
 
 
 class ResolveTicketIntegrationTestCase(BaseRelationsTestCase):
+
     def setUp(self):
         BaseRelationsTestCase.setUp(self)
 
 
     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'
 
 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()

File bloodhound_relations/bhrelations/web_ui.py

View file
     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:
         RelationNotifyEmail(self.env).notify(relation)
 
     # ITemplateProvider methods
+
     def get_htdocs_dirs(self):
         return []
 
         return [resource_filename('bhrelations', 'templates')]
 
     # IRequestFilter methods
+
     def pre_process_request(self, req, handler):
         return handler
 
                         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)

File bloodhound_relations/bhrelations/widgets/relations.py

View file
         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)
             '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)

File bloodhound_relations/setup.py

View file
 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 = [

File bloodhound_search/bhsearch/tests/query_suggestion.py

View file
 
 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__':

File bloodhound_search/bhsearch/tests/security.py

View file
 
 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__':

File bloodhound_search/bhsearch/tests/web_ui.py

View file
 
 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__':

File bloodhound_search/bhsearch/tests/whoosh_backend.py

View file
 
 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__':