/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test_registry.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
import sys
21
21
 
22
 
from bzrlib import (
 
22
from breezy import (
23
23
    branch,
24
24
    osutils,
25
25
    registry,
290
290
 
291
291
    def test_lazy_import_registry_foo(self):
292
292
        a_registry = registry.Registry()
293
 
        a_registry.register_lazy('foo', 'bzrlib.branch', 'Branch')
294
 
        a_registry.register_lazy('bar', 'bzrlib.branch', 'Branch.hooks')
 
293
        a_registry.register_lazy('foo', 'breezy.branch', 'Branch')
 
294
        a_registry.register_lazy('bar', 'breezy.branch', 'Branch.hooks')
295
295
        self.assertEqual(branch.Branch, a_registry.get('foo'))
296
296
        self.assertEqual(branch.Branch.hooks, a_registry.get('bar'))
297
297
 
311
311
        # By default the plugin won't be in the search path
312
312
        self.assertRaises(ImportError, a_registry.get, 'obj')
313
313
 
314
 
        plugin_path = os.getcwd() + '/tmp'
 
314
        plugin_path = self.test_dir + '/tmp'
315
315
        sys.path.append(plugin_path)
316
316
        try:
317
317
            obj = a_registry.get('obj')
342
342
 
343
343
    def test_lazy_import_get_module(self):
344
344
        a_registry = registry.Registry()
345
 
        a_registry.register_lazy('obj', "bzrlib.tests.test_registry",
 
345
        a_registry.register_lazy('obj', "breezy.tests.test_registry",
346
346
            'object1')
347
 
        self.assertEqual("bzrlib.tests.test_registry",
 
347
        self.assertEqual("breezy.tests.test_registry",
348
348
            a_registry._get_module("obj"))
349
349
 
350
350
    def test_normal_get_module(self):
352
352
            """Something"""
353
353
        a_registry = registry.Registry()
354
354
        a_registry.register("obj", AThing())
355
 
        self.assertEqual("bzrlib.tests.test_registry",
 
355
        self.assertEqual("breezy.tests.test_registry",
356
356
            a_registry._get_module("obj"))