~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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)