~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import bzrlib.commands
33
33
import bzrlib.help
34
34
from bzrlib.symbol_versioning import one_three
35
 
from bzrlib.tests import TestCase, TestCaseInTempDir
 
35
from bzrlib.tests import (
 
36
    TestCase,
 
37
    TestCaseInTempDir,
 
38
    TestUtil,
 
39
    )
36
40
from bzrlib.osutils import pathjoin, abspath, normpath
37
41
 
38
42
 
282
286
        plugin = bzrlib.plugin.plugins()['plugin']
283
287
        self.assertEqual('foo', plugin.test_suite())
284
288
 
 
289
    def test_no_load_plugin_tests_gives_None_for_load_plugin_tests(self):
 
290
        self.setup_plugin()
 
291
        loader = TestUtil.TestLoader()
 
292
        plugin = bzrlib.plugin.plugins()['plugin']
 
293
        self.assertEqual(None, plugin.load_plugin_tests(loader))
 
294
 
 
295
    def test_load_plugin_tests_gives_load_plugin_tests_result(self):
 
296
        source = """
 
297
def load_tests(standard_tests, module, loader):
 
298
    return 'foo'"""
 
299
        self.setup_plugin(source)
 
300
        loader = TestUtil.TestLoader()
 
301
        plugin = bzrlib.plugin.plugins()['plugin']
 
302
        self.assertEqual('foo', plugin.load_plugin_tests(loader))
 
303
 
285
304
    def test_no_version_info(self):
286
305
        self.setup_plugin()
287
306
        plugin = bzrlib.plugin.plugins()['plugin']
428
447
            bzrlib.plugin.set_plugins_path()
429
448
            expected_path = ['first', 'second',
430
449
                os.path.dirname(bzrlib.plugins.__file__)]
431
 
            self.assertEqual(expected_path, bzrlib.plugins.__path__)
 
450
            self.assertEqual(expected_path,
 
451
                bzrlib.plugins.__path__[:len(expected_path)])
432
452
        finally:
433
453
            bzrlib.plugins.__path__ = old_path
434
454
            if old_env != None:
436
456
            else:
437
457
                del os.environ['BZR_PLUGIN_PATH']
438
458
 
 
459
 
439
460
class TestHelpIndex(tests.TestCase):
440
461
    """Tests for the PluginsHelpIndex class."""
441
462