/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/script.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import shlex
27
27
import textwrap
28
28
 
29
 
from breezy import (
 
29
from .. import (
30
30
    osutils,
31
31
    tests,
32
32
    )
227
227
 
228
228
        try:
229
229
            self._check_output(output, actual_output, test_case)
230
 
        except AssertionError, e:
 
230
        except AssertionError as e:
231
231
            raise AssertionError(str(e) + " in stdout of command %s" % cmd)
232
232
        try:
233
233
            self._check_output(error, actual_error, test_case)
234
 
        except AssertionError, e:
 
234
        except AssertionError as e:
235
235
            raise AssertionError(str(e) +
236
236
                " in stderr of running command %s" % cmd)
237
237
        if retcode and not error and actual_error:
333
333
        for in_name in input_names:
334
334
            try:
335
335
                inputs.append(self._read_input(None, in_name))
336
 
            except IOError, e:
 
336
            except IOError as e:
337
337
                # Some filenames are illegal on Windows and generate EINVAL
338
338
                # rather than just saying the filename doesn't exist
339
339
                if e.errno in (errno.ENOENT, errno.EINVAL):
345
345
        # Handle output redirections
346
346
        try:
347
347
            output = self._write_output(output, out_name, out_mode)
348
 
        except IOError, e:
 
348
        except IOError as e:
349
349
            # If out_name cannot be created, we may get 'ENOENT', however if
350
350
            # out_name is something like '', we can get EINVAL
351
351
            if e.errno in (errno.ENOENT, errno.EINVAL):
366
366
        # Handle output redirections
367
367
        try:
368
368
            output = self._write_output(output, out_name, out_mode)
369
 
        except IOError, e:
 
369
        except IOError as e:
370
370
            if e.errno in (errno.ENOENT, errno.EINVAL):
371
371
                return 1, None, '%s: No such file or directory\n' % (out_name,)
372
372
            raise
423
423
            # FIXME: Should we put that in osutils ?
424
424
            try:
425
425
                os.remove(p)
426
 
            except OSError, e:
 
426
            except OSError as e:
427
427
                # Various OSes raises different exceptions (linux: EISDIR,
428
428
                #   win32: EACCES, OSX: EPERM) when invoked on a directory
429
429
                if e.errno in (errno.EISDIR, errno.EPERM, errno.EACCES):
457
457
            if os.path.isdir(dst):
458
458
                real_dst = os.path.join(dst, os.path.basename(src))
459
459
            os.rename(src, real_dst)
460
 
        except OSError, e:
 
460
        except OSError as e:
461
461
            if e.errno == errno.ENOENT:
462
462
                err = error('No such file or directory', src, dst)
463
463
            else: