85
51
# TODO: Write a test for plugin decoration of commands.
87
class TestOneNamedPluginOnly(TestCaseInTempDir):
53
class TestLoadingPlugins(TestCaseInTempDir):
89
55
activeattributes = {}
91
57
def test_plugins_with_the_same_name_are_not_loaded(self):
58
# This test tests that having two plugins in different directories does
59
# not result in both being loaded when they have the same name. get a
60
# file name we can use which is also a valid attribute for accessing in
61
# activeattributes. - we cannot give import parameters.
63
self.failIf(tempattribute in self.activeattributes)
64
# set a place for the plugins to record their loading, and at the same
65
# time validate that the location the plugins should record to is
67
bzrlib.tests.test_plugins.TestLoadingPlugins.activeattributes \
69
self.failUnless(tempattribute in self.activeattributes)
70
# create two plugin directories
73
# write a plugin that will record when its loaded in the
75
template = ("from bzrlib.tests.test_plugins import TestLoadingPlugins\n"
76
"TestLoadingPlugins.activeattributes[%r].append('%s')\n")
78
outfile = open(os.path.join('first', 'plugin.py'), 'w')
80
outfile.write(template % (tempattribute, 'first'))
85
outfile = open(os.path.join('second', 'plugin.py'), 'w')
87
outfile.write(template % (tempattribute, 'second'))
93
bzrlib.plugin.load_from_path(['first', 'second'])
94
self.assertEqual(['first'], self.activeattributes[tempattribute])
96
# remove the plugin 'plugin'
97
del self.activeattributes[tempattribute]
98
if 'bzrlib.plugins.plugin' in sys.modules:
99
del sys.modules['bzrlib.plugins.plugin']
100
if getattr(bzrlib.plugins, 'plugin', None):
101
del bzrlib.plugins.plugin
102
self.failIf(getattr(bzrlib.plugins, 'plugin', None))
104
def test_plugins_from_different_dirs_can_demand_load(self):
92
105
# This test tests that having two plugins in different
93
# directories does not result in both being loaded.
94
# get a file name we can use which is also a valid attribute
106
# directories with different names allows them both to be loaded, when
107
# we do a direct import statement.
108
# Determine a file name we can use which is also a valid attribute
95
109
# for accessing in activeattributes. - we cannot give import parameters.
110
tempattribute = "different-dirs"
97
111
self.failIf(tempattribute in self.activeattributes)
98
112
# set a place for the plugins to record their loading, and at the same
99
113
# time validate that the location the plugins should record to is
100
114
# valid and correct.
101
bzrlib.tests.test_plugins.TestOneNamedPluginOnly.activeattributes \
115
bzrlib.tests.test_plugins.TestLoadingPlugins.activeattributes \
102
116
[tempattribute] = []
103
117
self.failUnless(tempattribute in self.activeattributes)
104
118
# create two plugin directories
105
119
os.mkdir('first')
106
120
os.mkdir('second')
107
# write a plugin that will record when its loaded in the
121
# write plugins that will record when they are loaded in the
108
122
# tempattribute list.
109
template = ("from bzrlib.tests.test_plugins import TestOneNamedPluginOnly\n"
110
"TestOneNamedPluginOnly.activeattributes[%r].append('%s')\n")
111
print >> file(os.path.join('first', 'plugin.py'), 'w'), template % (tempattribute, 'first')
112
print >> file(os.path.join('second', 'plugin.py'), 'w'), template % (tempattribute, 'second')
114
bzrlib.plugin.load_from_dirs(['first', 'second'])
123
template = ("from bzrlib.tests.test_plugins import TestLoadingPlugins\n"
124
"TestLoadingPlugins.activeattributes[%r].append('%s')\n")
126
outfile = open(os.path.join('first', 'pluginone.py'), 'w')
128
outfile.write(template % (tempattribute, 'first'))
133
outfile = open(os.path.join('second', 'plugintwo.py'), 'w')
135
outfile.write(template % (tempattribute, 'second'))
140
oldpath = bzrlib.plugins.__path__
142
bzrlib.plugins.__path__ = ['first', 'second']
143
exec "import bzrlib.plugins.pluginone"
115
144
self.assertEqual(['first'], self.activeattributes[tempattribute])
117
# remove the plugin 'plugin'
118
del self.activeattributes[tempattribute]
119
if getattr(bzrlib.plugins, 'plugin', None):
120
del bzrlib.plugins.plugin
121
self.failIf(getattr(bzrlib.plugins, 'plugin', None))
124
class TestAllPlugins(TestCaseInTempDir):
126
def test_plugin_appears_in_all_plugins(self):
127
# This test tests a new plugin appears in bzrlib.plugin.all_plugins().
145
exec "import bzrlib.plugins.plugintwo"
146
self.assertEqual(['first', 'second'],
147
self.activeattributes[tempattribute])
149
# remove the plugin 'plugin'
150
del self.activeattributes[tempattribute]
151
if getattr(bzrlib.plugins, 'pluginone', None):
152
del bzrlib.plugins.pluginone
153
if getattr(bzrlib.plugins, 'plugintwo', None):
154
del bzrlib.plugins.plugintwo
155
self.failIf(getattr(bzrlib.plugins, 'pluginone', None))
156
self.failIf(getattr(bzrlib.plugins, 'plugintwo', None))
158
def test_plugins_can_load_from_directory_with_trailing_slash(self):
159
# This test tests that a plugin can load from a directory when the
160
# directory in the path has a trailing slash.
161
# check the plugin is not loaded already
162
self.failIf(getattr(bzrlib.plugins, 'ts_plugin', None))
163
tempattribute = "trailing-slash"
164
self.failIf(tempattribute in self.activeattributes)
165
# set a place for the plugin to record its loading, and at the same
166
# time validate that the location the plugin should record to is
168
bzrlib.tests.test_plugins.TestLoadingPlugins.activeattributes \
170
self.failUnless(tempattribute in self.activeattributes)
171
# create a directory for the plugin
172
os.mkdir('plugin_test')
173
# write a plugin that will record when its loaded in the
174
# tempattribute list.
175
template = ("from bzrlib.tests.test_plugins import TestLoadingPlugins\n"
176
"TestLoadingPlugins.activeattributes[%r].append('%s')\n")
178
outfile = open(os.path.join('plugin_test', 'ts_plugin.py'), 'w')
180
outfile.write(template % (tempattribute, 'plugin'))
186
bzrlib.plugin.load_from_path(['plugin_test'+os.sep])
187
self.assertEqual(['plugin'], self.activeattributes[tempattribute])
189
# remove the plugin 'plugin'
190
del self.activeattributes[tempattribute]
191
if getattr(bzrlib.plugins, 'ts_plugin', None):
192
del bzrlib.plugins.ts_plugin
193
self.failIf(getattr(bzrlib.plugins, 'ts_plugin', None))
195
def load_and_capture(self, name):
196
"""Load plugins from '.' capturing the output.
198
:param name: The name of the plugin.
199
:return: A string with the log from the plugin loading call.
204
handler = logging.StreamHandler(stream)
205
log = logging.getLogger('bzr')
206
log.addHandler(handler)
209
bzrlib.plugin.load_from_path(['.'])
211
if 'bzrlib.plugins.%s' % name in sys.modules:
212
del sys.modules['bzrlib.plugins.%s' % name]
213
if getattr(bzrlib.plugins, name, None):
214
delattr(bzrlib.plugins, name)
216
# Stop capturing output
219
log.removeHandler(handler)
220
return stream.getvalue()
224
def test_plugin_with_bad_api_version_reports(self):
225
# This plugin asks for bzrlib api version 1.0.0, which is not supported
230
f.write("import bzrlib.api\n"
231
"bzrlib.api.require_any_api(bzrlib, [(1, 0, 0)])\n")
235
log = self.load_and_capture(name)
236
self.assertContainsRe(log,
237
r"It requested API version")
239
def test_plugin_with_bad_name_does_not_load(self):
240
# The file name here invalid for a python module.
241
name = 'bzr-bad plugin-name..py'
242
file(name, 'w').close()
243
log = self.load_and_capture(name)
244
self.assertContainsRe(log,
245
r"Unable to load 'bzr-bad plugin-name\.' in '\.' as a plugin "
246
"because the file path isn't a valid module name; try renaming "
247
"it to 'bad_plugin_name_'\.")
250
class TestPlugins(TestCaseInTempDir):
252
def setup_plugin(self, source=""):
253
# This test tests a new plugin appears in bzrlib.plugin.plugins().
128
254
# check the plugin is not loaded already
129
255
self.failIf(getattr(bzrlib.plugins, 'plugin', None))
130
256
# write a plugin that _cannot_ fail to load.
131
print >> file('plugin.py', 'w'), ""
133
bzrlib.plugin.load_from_dirs(['.'])
134
self.failUnless('plugin' in bzrlib.plugin.all_plugins())
135
self.failUnless(getattr(bzrlib.plugins, 'plugin', None))
136
self.assertEqual(bzrlib.plugin.all_plugins()['plugin'],
137
bzrlib.plugins.plugin)
139
# remove the plugin 'plugin'
140
if getattr(bzrlib.plugins, 'plugin', None):
141
del bzrlib.plugins.plugin
257
file('plugin.py', 'w').write(source + '\n')
258
self.addCleanup(self.teardown_plugin)
259
bzrlib.plugin.load_from_path(['.'])
261
def teardown_plugin(self):
262
# remove the plugin 'plugin'
263
if 'bzrlib.plugins.plugin' in sys.modules:
264
del sys.modules['bzrlib.plugins.plugin']
265
if getattr(bzrlib.plugins, 'plugin', None):
266
del bzrlib.plugins.plugin
142
267
self.failIf(getattr(bzrlib.plugins, 'plugin', None))
269
def test_plugin_appears_in_plugins(self):
271
self.failUnless('plugin' in bzrlib.plugin.plugins())
272
self.failUnless(getattr(bzrlib.plugins, 'plugin', None))
273
plugins = bzrlib.plugin.plugins()
274
plugin = plugins['plugin']
275
self.assertIsInstance(plugin, bzrlib.plugin.PlugIn)
276
self.assertEqual(bzrlib.plugins.plugin, plugin.module)
278
def test_trivial_plugin_get_path(self):
280
plugins = bzrlib.plugin.plugins()
281
plugin = plugins['plugin']
282
plugin_path = self.test_dir + '/plugin.py'
283
self.assertIsSameRealPath(plugin_path, normpath(plugin.path()))
285
def test_plugin_get_path_py_not_pyc(self):
286
self.setup_plugin() # after first import there will be plugin.pyc
287
self.teardown_plugin()
288
bzrlib.plugin.load_from_path(['.']) # import plugin.pyc
289
plugins = bzrlib.plugin.plugins()
290
plugin = plugins['plugin']
291
plugin_path = self.test_dir + '/plugin.py'
292
self.assertIsSameRealPath(plugin_path, normpath(plugin.path()))
294
def test_plugin_get_path_pyc_only(self):
295
self.setup_plugin() # after first import there will be plugin.pyc
296
self.teardown_plugin()
297
os.unlink(self.test_dir + '/plugin.py')
298
bzrlib.plugin.load_from_path(['.']) # import plugin.pyc
299
plugins = bzrlib.plugin.plugins()
300
plugin = plugins['plugin']
302
plugin_path = self.test_dir + '/plugin.pyc'
304
plugin_path = self.test_dir + '/plugin.pyo'
305
self.assertIsSameRealPath(plugin_path, normpath(plugin.path()))
307
def test_no_test_suite_gives_None_for_test_suite(self):
309
plugin = bzrlib.plugin.plugins()['plugin']
310
self.assertEqual(None, plugin.test_suite())
312
def test_test_suite_gives_test_suite_result(self):
313
source = """def test_suite(): return 'foo'"""
314
self.setup_plugin(source)
315
plugin = bzrlib.plugin.plugins()['plugin']
316
self.assertEqual('foo', plugin.test_suite())
318
def test_no_load_plugin_tests_gives_None_for_load_plugin_tests(self):
320
loader = TestUtil.TestLoader()
321
plugin = bzrlib.plugin.plugins()['plugin']
322
self.assertEqual(None, plugin.load_plugin_tests(loader))
324
def test_load_plugin_tests_gives_load_plugin_tests_result(self):
326
def load_tests(standard_tests, module, loader):
328
self.setup_plugin(source)
329
loader = TestUtil.TestLoader()
330
plugin = bzrlib.plugin.plugins()['plugin']
331
self.assertEqual('foo', plugin.load_plugin_tests(loader))
333
def test_no_version_info(self):
335
plugin = bzrlib.plugin.plugins()['plugin']
336
self.assertEqual(None, plugin.version_info())
338
def test_with_version_info(self):
339
self.setup_plugin("version_info = (1, 2, 3, 'dev', 4)")
340
plugin = bzrlib.plugin.plugins()['plugin']
341
self.assertEqual((1, 2, 3, 'dev', 4), plugin.version_info())
343
def test_short_version_info_gets_padded(self):
344
# the gtk plugin has version_info = (1,2,3) rather than the 5-tuple.
346
self.setup_plugin("version_info = (1, 2, 3)")
347
plugin = bzrlib.plugin.plugins()['plugin']
348
self.assertEqual((1, 2, 3, 'final', 0), plugin.version_info())
350
def test_no_version_info___version__(self):
352
plugin = bzrlib.plugin.plugins()['plugin']
353
self.assertEqual("unknown", plugin.__version__)
355
def test_str__version__with_version_info(self):
356
self.setup_plugin("version_info = '1.2.3'")
357
plugin = bzrlib.plugin.plugins()['plugin']
358
self.assertEqual("1.2.3", plugin.__version__)
360
def test_noniterable__version__with_version_info(self):
361
self.setup_plugin("version_info = (1)")
362
plugin = bzrlib.plugin.plugins()['plugin']
363
self.assertEqual("1", plugin.__version__)
365
def test_1__version__with_version_info(self):
366
self.setup_plugin("version_info = (1,)")
367
plugin = bzrlib.plugin.plugins()['plugin']
368
self.assertEqual("1", plugin.__version__)
370
def test_1_2__version__with_version_info(self):
371
self.setup_plugin("version_info = (1, 2)")
372
plugin = bzrlib.plugin.plugins()['plugin']
373
self.assertEqual("1.2", plugin.__version__)
375
def test_1_2_3__version__with_version_info(self):
376
self.setup_plugin("version_info = (1, 2, 3)")
377
plugin = bzrlib.plugin.plugins()['plugin']
378
self.assertEqual("1.2.3", plugin.__version__)
380
def test_candidate__version__with_version_info(self):
381
self.setup_plugin("version_info = (1, 2, 3, 'candidate', 1)")
382
plugin = bzrlib.plugin.plugins()['plugin']
383
self.assertEqual("1.2.3rc1", plugin.__version__)
385
def test_dev__version__with_version_info(self):
386
self.setup_plugin("version_info = (1, 2, 3, 'dev', 0)")
387
plugin = bzrlib.plugin.plugins()['plugin']
388
self.assertEqual("1.2.3dev", plugin.__version__)
390
def test_dev_fallback__version__with_version_info(self):
391
self.setup_plugin("version_info = (1, 2, 3, 'dev', 4)")
392
plugin = bzrlib.plugin.plugins()['plugin']
393
self.assertEqual("1.2.3dev4", plugin.__version__)
395
def test_final__version__with_version_info(self):
396
self.setup_plugin("version_info = (1, 2, 3, 'final', 0)")
397
plugin = bzrlib.plugin.plugins()['plugin']
398
self.assertEqual("1.2.3", plugin.__version__)
400
def test_final_fallback__version__with_version_info(self):
401
self.setup_plugin("version_info = (1, 2, 3, 'final', 2)")
402
plugin = bzrlib.plugin.plugins()['plugin']
403
self.assertEqual("1.2.3.final.2", plugin.__version__)
145
406
class TestPluginHelp(TestCaseInTempDir):
147
408
def split_help_commands(self):
150
for line in self.capture('help commands').splitlines():
151
if line.startswith('bzr '):
152
current = line.split()[1]
411
out, err = self.run_bzr('--no-plugins help commands')
412
for line in out.splitlines():
413
if not line.startswith(' '):
414
current = line.split()[0]
153
415
help[current] = help.get(current, '') + line
187
bzrlib.plugin.load_from_dirs(['plugin_test'])
447
bzrlib.plugin.load_from_path(['plugin_test'])
188
448
bzrlib.commands.register_command( bzrlib.plugins.myplug.cmd_myplug)
189
help = self.capture('help myplug')
190
self.assertContainsRe(help, 'From plugin "myplug"')
449
help = self.run_bzr('help myplug')[0]
450
self.assertContainsRe(help, 'plugin "myplug"')
191
451
help = self.split_help_commands()['myplug']
192
self.assertContainsRe(help, 'From plugin "myplug"')
194
# remove the plugin 'plugin'
195
if getattr(bzrlib.plugins, 'plugin', None):
196
del bzrlib.plugins.plugin
452
self.assertContainsRe(help, '\[myplug\]')
455
if 'myplug' in bzrlib.commands.plugin_cmds:
456
bzrlib.commands.plugin_cmds.remove('myplug')
457
# remove the plugin 'myplug'
458
if getattr(bzrlib.plugins, 'myplug', None):
459
delattr(bzrlib.plugins, 'myplug')
462
class TestSetPluginsPath(TestCase):
464
def test_set_plugins_path(self):
465
"""set_plugins_path should set the module __path__ correctly."""
466
old_path = bzrlib.plugins.__path__
468
bzrlib.plugins.__path__ = []
469
expected_path = bzrlib.plugin.set_plugins_path()
470
self.assertEqual(expected_path, bzrlib.plugins.__path__)
472
bzrlib.plugins.__path__ = old_path
474
def test_set_plugins_path_with_trailing_slashes(self):
475
"""set_plugins_path should set the module __path__ based on
476
BZR_PLUGIN_PATH after removing all trailing slashes."""
477
old_path = bzrlib.plugins.__path__
478
old_env = os.environ.get('BZR_PLUGIN_PATH')
480
bzrlib.plugins.__path__ = []
481
os.environ['BZR_PLUGIN_PATH'] = "first\\//\\" + os.pathsep + \
483
bzrlib.plugin.set_plugins_path()
484
# We expect our nominated paths to have all path-seps removed,
485
# and this is testing only that.
486
expected_path = ['first', 'second']
487
self.assertEqual(expected_path,
488
bzrlib.plugins.__path__[:len(expected_path)])
490
bzrlib.plugins.__path__ = old_path
491
if old_env is not None:
492
os.environ['BZR_PLUGIN_PATH'] = old_env
494
del os.environ['BZR_PLUGIN_PATH']
497
class TestHelpIndex(tests.TestCase):
498
"""Tests for the PluginsHelpIndex class."""
500
def test_default_constructable(self):
501
index = plugin.PluginsHelpIndex()
503
def test_get_topics_None(self):
504
"""Searching for None returns an empty list."""
505
index = plugin.PluginsHelpIndex()
506
self.assertEqual([], index.get_topics(None))
508
def test_get_topics_for_plugin(self):
509
"""Searching for plugin name gets its docstring."""
510
index = plugin.PluginsHelpIndex()
511
# make a new plugin here for this test, even if we're run with
513
self.assertFalse(sys.modules.has_key('bzrlib.plugins.demo_module'))
514
demo_module = FakeModule('', 'bzrlib.plugins.demo_module')
515
sys.modules['bzrlib.plugins.demo_module'] = demo_module
517
topics = index.get_topics('demo_module')
518
self.assertEqual(1, len(topics))
519
self.assertIsInstance(topics[0], plugin.ModuleHelpTopic)
520
self.assertEqual(demo_module, topics[0].module)
522
del sys.modules['bzrlib.plugins.demo_module']
524
def test_get_topics_no_topic(self):
525
"""Searching for something that is not a plugin returns []."""
526
# test this by using a name that cannot be a plugin - its not
527
# a valid python identifier.
528
index = plugin.PluginsHelpIndex()
529
self.assertEqual([], index.get_topics('nothing by this name'))
531
def test_prefix(self):
532
"""PluginsHelpIndex has a prefix of 'plugins/'."""
533
index = plugin.PluginsHelpIndex()
534
self.assertEqual('plugins/', index.prefix)
536
def test_get_plugin_topic_with_prefix(self):
537
"""Searching for plugins/demo_module returns help."""
538
index = plugin.PluginsHelpIndex()
539
self.assertFalse(sys.modules.has_key('bzrlib.plugins.demo_module'))
540
demo_module = FakeModule('', 'bzrlib.plugins.demo_module')
541
sys.modules['bzrlib.plugins.demo_module'] = demo_module
543
topics = index.get_topics('plugins/demo_module')
544
self.assertEqual(1, len(topics))
545
self.assertIsInstance(topics[0], plugin.ModuleHelpTopic)
546
self.assertEqual(demo_module, topics[0].module)
548
del sys.modules['bzrlib.plugins.demo_module']
551
class FakeModule(object):
552
"""A fake module to test with."""
554
def __init__(self, doc, name):
559
class TestModuleHelpTopic(tests.TestCase):
560
"""Tests for the ModuleHelpTopic class."""
562
def test_contruct(self):
563
"""Construction takes the module to document."""
564
mod = FakeModule('foo', 'foo')
565
topic = plugin.ModuleHelpTopic(mod)
566
self.assertEqual(mod, topic.module)
568
def test_get_help_text_None(self):
569
"""A ModuleHelpTopic returns the docstring for get_help_text."""
570
mod = FakeModule(None, 'demo')
571
topic = plugin.ModuleHelpTopic(mod)
572
self.assertEqual("Plugin 'demo' has no docstring.\n",
573
topic.get_help_text())
575
def test_get_help_text_no_carriage_return(self):
576
"""ModuleHelpTopic.get_help_text adds a \n if needed."""
577
mod = FakeModule('one line of help', 'demo')
578
topic = plugin.ModuleHelpTopic(mod)
579
self.assertEqual("one line of help\n",
580
topic.get_help_text())
582
def test_get_help_text_carriage_return(self):
583
"""ModuleHelpTopic.get_help_text adds a \n if needed."""
584
mod = FakeModule('two lines of help\nand more\n', 'demo')
585
topic = plugin.ModuleHelpTopic(mod)
586
self.assertEqual("two lines of help\nand more\n",
587
topic.get_help_text())
589
def test_get_help_text_with_additional_see_also(self):
590
mod = FakeModule('two lines of help\nand more', 'demo')
591
topic = plugin.ModuleHelpTopic(mod)
592
self.assertEqual("two lines of help\nand more\nSee also: bar, foo\n",
593
topic.get_help_text(['foo', 'bar']))
595
def test_get_help_topic(self):
596
"""The help topic for a plugin is its module name."""
597
mod = FakeModule('two lines of help\nand more', 'bzrlib.plugins.demo')
598
topic = plugin.ModuleHelpTopic(mod)
599
self.assertEqual('demo', topic.get_help_topic())
600
mod = FakeModule('two lines of help\nand more', 'bzrlib.plugins.foo_bar')
601
topic = plugin.ModuleHelpTopic(mod)
602
self.assertEqual('foo_bar', topic.get_help_topic())
605
def clear_plugins(test_case):
606
# Save the attributes that we're about to monkey-patch.
607
old_plugins_path = bzrlib.plugins.__path__
608
old_loaded = plugin._loaded
609
old_load_from_path = plugin.load_from_path
610
# Change bzrlib.plugin to think no plugins have been loaded yet.
611
bzrlib.plugins.__path__ = []
612
plugin._loaded = False
613
# Monkey-patch load_from_path to stop it from actually loading anything.
614
def load_from_path(dirs):
616
plugin.load_from_path = load_from_path
617
def restore_plugins():
618
bzrlib.plugins.__path__ = old_plugins_path
619
plugin._loaded = old_loaded
620
plugin.load_from_path = old_load_from_path
621
test_case.addCleanup(restore_plugins)
624
class TestPluginPaths(tests.TestCase):
626
def test_set_plugins_path_with_args(self):
628
plugin.set_plugins_path(['a', 'b'])
629
self.assertEqual(['a', 'b'], bzrlib.plugins.__path__)
631
def test_set_plugins_path_defaults(self):
633
plugin.set_plugins_path()
634
self.assertEqual(plugin.get_standard_plugins_path(),
635
bzrlib.plugins.__path__)
637
def test_get_standard_plugins_path(self):
638
path = plugin.get_standard_plugins_path()
639
self.assertEqual(plugin.get_default_plugin_path(), path[0])
640
for directory in path:
641
self.assertNotContainsRe(directory, r'\\/$')
643
from distutils.sysconfig import get_python_lib
647
if sys.platform != 'win32':
648
python_lib = get_python_lib()
649
for directory in path:
650
if directory.startswith(python_lib):
653
self.fail('No path to global plugins')
655
def test_get_standard_plugins_path_env(self):
656
os.environ['BZR_PLUGIN_PATH'] = 'foo/'
657
self.assertEqual('foo', plugin.get_standard_plugins_path()[0])
660
class TestLoadPlugins(tests.TestCaseInTempDir):
662
def test_load_plugins(self):
664
plugin.load_plugins(['.'])
665
self.assertEqual(bzrlib.plugins.__path__, ['.'])
666
# subsequent loads are no-ops
667
plugin.load_plugins(['foo'])
668
self.assertEqual(bzrlib.plugins.__path__, ['.'])
670
def test_load_plugins_default(self):
672
plugin.load_plugins()
673
path = plugin.get_standard_plugins_path()
674
self.assertEqual(path, bzrlib.plugins.__path__)