18
18
"""Tests for plugins"""
20
# XXX: There are no plugin tests at the moment because the plugin module
21
# affects the global state of the process. See bzrlib/plugins.py for more
22
# **************************************************
24
# **************************************************
26
33
from bzrlib.selftest import TestCaseInTempDir
28
36
class PluginTest(TestCaseInTempDir):
29
37
"""Create an external plugin and test loading."""
30
# def test_plugin_loading(self):
31
# orig_help = self.run_bzr_captured('bzr help commands')[0]
32
# os.mkdir('plugin_test')
33
# f = open(os.path.join('plugin_test', 'myplug.py'), 'wt')
34
# f.write(PLUGIN_TEXT)
36
# newhelp = self.run_bzr_captured('bzr help commands')[0]
37
# assert newhelp.startswith('You have been overridden\n')
38
# # We added a line, but the rest should work
39
# assert newhelp[25:] == help
41
# assert backtick('bzr commit -m test') == "I'm sorry dave, you can't do that\n"
43
# shutil.rmtree('plugin_test')
38
def test_plugin_loading(self):
41
orig_help = self.backtick('bzr help commands') # No plugins yet
42
os.mkdir('plugin_test')
43
f = open(os.path.join('plugin_test', 'myplug.py'), 'wt')
47
newhelp = backtick('bzr help commands')
48
assert newhelp.startswith('You have been overridden\n')
49
# We added a line, but the rest should work
50
assert newhelp[25:] == help
52
assert backtick('bzr commit -m test') == "I'm sorry dave, you can't do that\n"
54
shutil.rmtree('plugin_test')
60
# """import bzrlib, bzrlib.commands
61
# class cmd_myplug(bzrlib.commands.Command):
62
# '''Just a simple test plugin.'''
65
# print 'Hello from my plugin'
46
69
# os.environ['BZRPLUGINPATH'] = os.path.abspath('plugin_test')
47
70
# help = backtick('bzr help commands')
66
89
# bzrlib.commands.cmd_help.run(self, *args, **kwargs)
71
import bzrlib.commands
72
class cmd_myplug(bzrlib.commands.Command):
73
'''Just a simple test plugin.'''
76
print 'Hello from my plugin'