/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 bzrlib/tests/script.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import shlex
27
27
import textwrap
28
28
 
29
 
from .. import (
 
29
from bzrlib import (
30
30
    osutils,
31
31
    tests,
32
32
    )
177
177
    
178
178
    Can be used as:
179
179
 
180
 
    from breezy.tests import script
 
180
    from bzrlib.tests import script
181
181
 
182
182
    ...
183
183
 
184
184
        def test_bug_nnnnn(self):
185
185
            sr = script.ScriptRunner()
186
186
            sr.run_script(self, '''
187
 
            $ brz init
188
 
            $ brz do-this
 
187
            $ bzr init
 
188
            $ bzr do-this
189
189
            # Boom, error
190
190
            ''')
191
191
    """
227
227
 
228
228
        try:
229
229
            self._check_output(output, actual_output, test_case)
230
 
        except AssertionError as e:
 
230
        except AssertionError, 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 as e:
 
234
        except AssertionError, 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:
314
314
            output = None
315
315
        return output
316
316
 
317
 
    def do_brz(self, test_case, input, args):
 
317
    def do_bzr(self, test_case, input, args):
318
318
        retcode, out, err = test_case._run_bzr_core(
319
319
            args, retcode=None, encoding=None, stdin=input, working_dir=None)
320
320
        return retcode, out, err
333
333
        for in_name in input_names:
334
334
            try:
335
335
                inputs.append(self._read_input(None, in_name))
336
 
            except IOError as e:
 
336
            except IOError, 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 as e:
 
348
        except IOError, 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 as e:
 
369
        except IOError, 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 as e:
 
426
            except OSError, 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 as e:
 
460
        except OSError, e:
461
461
            if e.errno == errno.ENOENT:
462
462
                err = error('No such file or directory', src, dst)
463
463
            else:
499
499
 
500
500
    Can be used as:
501
501
 
502
 
    from breezy.tests import script
 
502
    from bzrlib.tests import script
503
503
 
504
504
 
505
505
    class TestBug(script.TestCaseWithTransportAndScript):
506
506
 
507
507
        def test_bug_nnnnn(self):
508
508
            self.run_script('''
509
 
            $ brz init
510
 
            $ brz do-this
 
509
            $ bzr init
 
510
            $ bzr do-this
511
511
            # Boom, error
512
512
            ''')
513
513
    """