~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

merge trunk and resolve conflicts to cleanup submission

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    edit_commit_message_encoded
36
36
)
37
37
from bzrlib.tests import (
 
38
    TestCaseInTempDir,
38
39
    TestCaseWithTransport,
39
40
    TestNotApplicable,
40
41
    TestSkipped,
290
291
        # Call _run_editor, capturing mutter.warning calls.
291
292
        warnings = []
292
293
        def warning(*args):
293
 
            warnings.append(args[0] % args[1:])
 
294
            if len(args) > 1:
 
295
                warnings.append(args[0] % args[1:])
 
296
            else:
 
297
                warnings.append(args[0])
294
298
        _warning = trace.warning
295
299
        trace.warning = warning
296
300
        try:
364
368
        commit_obj = commit.Commit()
365
369
        self.assertEquals("save me some typing\n",
366
370
            msgeditor.generate_commit_message_template(commit_obj))
 
371
 
 
372
 
 
373
# GZ 2009-11-17: This wants moving to osutils when the errno checking code is
 
374
class TestPlatformErrnoWorkarounds(TestCaseInTempDir):
 
375
    """Ensuring workarounds enshrined in code actually serve a purpose"""
 
376
 
 
377
    def test_subprocess_call_bad_file(self):
 
378
        if sys.platform != "win32":
 
379
            raise TestNotApplicable("Workarounds for windows only")
 
380
        import subprocess, errno
 
381
        ERROR_BAD_EXE_FORMAT = 193
 
382
        file("textfile.txt", "w").close()
 
383
        e = self.assertRaises(WindowsError, subprocess.call, "textfile.txt")
 
384
        # Python2.4 used the 'winerror' as the errno, which confuses a lot of
 
385
        # our error trapping code. Make sure that we understand the mapping
 
386
        # correctly.
 
387
        if sys.version_info >= (2, 5):
 
388
            self.assertEqual(e.errno, errno.ENOEXEC)
 
389
            self.assertEqual(e.winerror, ERROR_BAD_EXE_FORMAT)
 
390
        else:
 
391
            self.assertEqual(e.errno, ERROR_BAD_EXE_FORMAT)