~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: John Arbash Meinel
  • Date: 2010-05-10 19:36:37 UTC
  • mto: This revision was merged to the branch mainline in revision 419.
  • Revision ID: john@arbash-meinel.com-20100510193637-4vmxsw7ha5wz0pi2
Allow running the loggerhead test suite using 'bzr selftest'

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        logging.getLogger('simpleTAL').addHandler(handler)
70
70
        logging.getLogger('simpleTALES').addHandler(handler)
71
71
 
72
 
    def serve_http(transport, host=None, port=None, inet=None):
73
 
        from paste.httpexceptions import HTTPExceptionHandler
74
 
        from paste.httpserver import serve
75
72
 
 
73
    def _ensure_loggerhead_path():
 
74
        """Ensure that you can 'import loggerhead' and get the root."""
76
75
        # loggerhead internal code will try to 'import loggerhead', so
77
76
        # let's put it on the path if we can't find it in the existing path
78
77
        try:
81
80
            import os.path, sys
82
81
            sys.path.append(os.path.dirname(__file__))
83
82
 
 
83
    def serve_http(transport, host=None, port=None, inet=None):
 
84
        from paste.httpexceptions import HTTPExceptionHandler
 
85
        from paste.httpserver import serve
 
86
 
 
87
        _ensure_loggerhead_path()
 
88
 
84
89
        from loggerhead.apps.transport import BranchesFromTransportRoot
85
90
        from loggerhead.config import LoggerheadConfig
86
91
 
132
137
                    super(cmd_serve, self).run(*args, **kw)
133
138
 
134
139
        register_command(cmd_serve)
 
140
 
 
141
    def load_tests(standard_tests, module, loader):
 
142
        _ensure_loggerhead_path()
 
143
        standard_tests.addTests(loader.loadTestsFromModuleNames(
 
144
            ['bzrlib.plugins.loggerhead.loggerhead.tests']))
 
145
        return standard_tests