~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

Abbreviate pack_stat struct format to '>6L'

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,
37
38
    TestCaseInTempDir,
38
39
    TestCaseWithTransport,
39
40
    TestNotApplicable,
309
310
        self.assertFileEqual(expected, msgfilename)
310
311
 
311
312
    def test__create_temp_file_with_commit_template_in_unicode_dir(self):
312
 
        self.requireFeature(tests.UnicodeFilenameFeature)
 
313
        self.requireFeature(features.UnicodeFilenameFeature)
313
314
        if hasattr(self, 'info'):
314
315
            tmpdir = self.info['directory']
315
316
            os.mkdir(tmpdir)
344
345
        self.assertRaises(errors.BadCommitMessageEncoding,
345
346
                          msgeditor.edit_commit_message, '')
346
347
 
 
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
 
347
360
    def test_generate_commit_message_template_no_hooks(self):
348
361
        commit_obj = commit.Commit()
349
362
        self.assertIs(None,
368
381
        ERROR_BAD_EXE_FORMAT = 193
369
382
        file("textfile.txt", "w").close()
370
383
        e = self.assertRaises(WindowsError, subprocess.call, "textfile.txt")
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)
 
384
        self.assertEqual(e.errno, errno.ENOEXEC)
 
385
        self.assertEqual(e.winerror, ERROR_BAD_EXE_FORMAT)