~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

(gz) Fix test failure on alpha by correcting format string for
 gc_chk_sha1_record (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    edit_commit_message_encoded
35
35
)
36
36
from bzrlib.tests import (
37
 
    features,
38
37
    TestCaseInTempDir,
39
38
    TestCaseWithTransport,
40
39
    TestNotApplicable,
310
309
        self.assertFileEqual(expected, msgfilename)
311
310
 
312
311
    def test__create_temp_file_with_commit_template_in_unicode_dir(self):
313
 
        self.requireFeature(features.UnicodeFilenameFeature)
 
312
        self.requireFeature(tests.UnicodeFilenameFeature)
314
313
        if hasattr(self, 'info'):
315
314
            tmpdir = self.info['directory']
316
315
            os.mkdir(tmpdir)
345
344
        self.assertRaises(errors.BadCommitMessageEncoding,
346
345
                          msgeditor.edit_commit_message, '')
347
346
 
348
 
    def test_set_commit_message_no_hooks(self):
349
 
        commit_obj = commit.Commit()
350
 
        self.assertIs(None,
351
 
            msgeditor.set_commit_message(commit_obj))
352
 
 
353
 
    def test_set_commit_message_hook(self):
354
 
        msgeditor.hooks.install_named_hook("set_commit_message",
355
 
                lambda commit_obj, existing_message: "save me some typing\n", None)
356
 
        commit_obj = commit.Commit()
357
 
        self.assertEquals("save me some typing\n",
358
 
            msgeditor.set_commit_message(commit_obj))
359
 
 
360
347
    def test_generate_commit_message_template_no_hooks(self):
361
348
        commit_obj = commit.Commit()
362
349
        self.assertIs(None,
381
368
        ERROR_BAD_EXE_FORMAT = 193
382
369
        file("textfile.txt", "w").close()
383
370
        e = self.assertRaises(WindowsError, subprocess.call, "textfile.txt")
384
 
        self.assertEqual(e.errno, errno.ENOEXEC)
385
 
        self.assertEqual(e.winerror, ERROR_BAD_EXE_FORMAT)
 
371
        # Python2.4 used the 'winerror' as the errno, which confuses a lot of
 
372
        # our error trapping code. Make sure that we understand the mapping
 
373
        # correctly.
 
374
        if sys.version_info >= (2, 5):
 
375
            self.assertEqual(e.errno, errno.ENOEXEC)
 
376
            self.assertEqual(e.winerror, ERROR_BAD_EXE_FORMAT)
 
377
        else:
 
378
            self.assertEqual(e.errno, ERROR_BAD_EXE_FORMAT)