~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

  • Committer: Mark Hammond
  • Date: 2008-08-11 02:04:43 UTC
  • mto: This revision was merged to the branch mainline in revision 3620.
  • Revision ID: mhammond@skippinet.com.au-20080811020443-koy7d1dhucshppkv
make plugin test clearer and simpler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
441
441
        old_path = bzrlib.plugins.__path__
442
442
        old_env = os.environ.get('BZR_PLUGIN_PATH')
443
443
        try:
444
 
            # first determine the default builtin path
445
 
            bzrlib.plugins.__path__ = []
446
 
            if old_env is not None:
447
 
                del os.environ['BZR_PLUGIN_PATH']
448
 
            bzrlib.plugin.set_plugins_path()
449
 
            default = bzrlib.plugins.__path__[-1:]
450
 
            # now adjust env and new ones correctly added.
 
444
            # After setting BZR_PLUGIN_PATH, we expect the new path to be
 
445
            # the nominated paths followed by the builtin plugin path.
 
446
            # The builtin plugin path is always at the end (some platforms
 
447
            # may stick default entries at the start if BZR_PLUGIN_PATH 
 
448
            # isn't set)
 
449
            builtin_path = bzrlib.plugins.__path__[-1]
451
450
            bzrlib.plugins.__path__ = []
452
451
            os.environ['BZR_PLUGIN_PATH'] = "first\\//\\" + os.pathsep + \
453
452
                "second/\\/\\/"
454
453
            bzrlib.plugin.set_plugins_path()
455
 
            expected_path = ['first', 'second'] + default
 
454
            # We expect our nominated paths to have all path-seps removed.
 
455
            expected_path = ['first', 'second', builtin_path]
456
456
            self.assertEqual(expected_path,
457
457
                bzrlib.plugins.__path__[:len(expected_path)])
458
458
        finally: