~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-11-17 03:20:35 UTC
  • mfrom: (4792.4.3 456036)
  • Revision ID: pqm@pqm.ubuntu.com-20091117032035-s3sgtlixj1lrminn
(Gordon Tyler) Fix IndexError during 'bzr ignore /' (#456036)

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,
39
38
    TestCaseWithTransport,
40
39
    TestNotApplicable,
41
40
    TestSkipped,
291
290
        # Call _run_editor, capturing mutter.warning calls.
292
291
        warnings = []
293
292
        def warning(*args):
294
 
            if len(args) > 1:
295
 
                warnings.append(args[0] % args[1:])
296
 
            else:
297
 
                warnings.append(args[0])
 
293
            warnings.append(args[0] % args[1:])
298
294
        _warning = trace.warning
299
295
        trace.warning = warning
300
296
        try:
368
364
        commit_obj = commit.Commit()
369
365
        self.assertEquals("save me some typing\n",
370
366
            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)