/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_plugins.py

  • Committer: Daniel Watkins
  • Date: 2007-11-06 09:33:05 UTC
  • mfrom: (2967 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2993.
  • Revision ID: d.m.watkins@warwick.ac.uk-20071106093305-zfef3c0jbcvunnuz
Merged bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import bzrlib.help
33
33
from bzrlib.symbol_versioning import zero_ninetyone
34
34
from bzrlib.tests import TestCase, TestCaseInTempDir
35
 
from bzrlib.osutils import pathjoin, abspath
 
35
from bzrlib.osutils import pathjoin, abspath, normpath
36
36
 
37
37
 
38
38
PLUGIN_TEXT = """\
73
73
 
74
74
        outfile = open(os.path.join('first', 'plugin.py'), 'w')
75
75
        try:
76
 
            print >> outfile, template % (tempattribute, 'first')
 
76
            outfile.write(template % (tempattribute, 'first'))
 
77
            outfile.write('\n')
77
78
        finally:
78
79
            outfile.close()
79
80
 
80
81
        outfile = open(os.path.join('second', 'plugin.py'), 'w')
81
82
        try:
82
 
            print >> outfile, template % (tempattribute, 'second')
 
83
            outfile.write(template % (tempattribute, 'second'))
 
84
            outfile.write('\n')
83
85
        finally:
84
86
            outfile.close()
85
87
 
119
121
 
120
122
        outfile = open(os.path.join('first', 'pluginone.py'), 'w')
121
123
        try:
122
 
            print >> outfile, template % (tempattribute, 'first')
 
124
            outfile.write(template % (tempattribute, 'first'))
 
125
            outfile.write('\n')
123
126
        finally:
124
127
            outfile.close()
125
128
 
126
129
        outfile = open(os.path.join('second', 'plugintwo.py'), 'w')
127
130
        try:
128
 
            print >> outfile, template % (tempattribute, 'second')
 
131
            outfile.write(template % (tempattribute, 'second'))
 
132
            outfile.write('\n')
129
133
        finally:
130
134
            outfile.close()
131
135
 
169
173
 
170
174
        outfile = open(os.path.join('plugin_test', 'ts_plugin.py'), 'w')
171
175
        try:
172
 
            print >> outfile, template % (tempattribute, 'plugin')
 
176
            outfile.write(template % (tempattribute, 'plugin'))
 
177
            outfile.write('\n')
173
178
        finally:
174
179
            outfile.close()
175
180
 
191
196
        # check the plugin is not loaded already
192
197
        self.failIf(getattr(bzrlib.plugins, 'plugin', None))
193
198
        # write a plugin that _cannot_ fail to load.
194
 
        print >> file('plugin.py', 'w'), ""
 
199
        file('plugin.py', 'w').write("\n")
195
200
        try:
196
201
            bzrlib.plugin.load_from_path(['.'])
197
202
            all_plugins = self.applyDeprecated(zero_ninetyone,
215
220
        # check the plugin is not loaded already
216
221
        self.failIf(getattr(bzrlib.plugins, 'plugin', None))
217
222
        # write a plugin that _cannot_ fail to load.
218
 
        print >> file('plugin.py', 'w'), source
 
223
        file('plugin.py', 'w').write(source + '\n')
219
224
        self.addCleanup(self.teardown_plugin)
220
225
        bzrlib.plugin.load_from_path(['.'])
221
226
    
241
246
        plugins = bzrlib.plugin.plugins()
242
247
        plugin = plugins['plugin']
243
248
        plugin_path = self.test_dir + '/plugin.py'
244
 
        self.assertEqual(plugin_path, plugin.path())
 
249
        self.assertIsSameRealPath(plugin_path, normpath(plugin.path()))
245
250
 
246
251
    def test_no_test_suite_gives_None_for_test_suite(self):
247
252
        self.setup_plugin()