Rev 4815: 2.1.0b4-win32-test-script was accepted in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted
John Arbash Meinel
john at arbash-meinel.com
Mon Nov 16 20:49:06 GMT 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted
------------------------------------------------------------
revno: 4815 [merge]
revision-id: john at arbash-meinel.com-20091116204901-2ybzsg97u89xjbjo
parent: john at arbash-meinel.com-20091116204805-aziloi9q1vd2t231
parent: john at arbash-meinel.com-20091108202836-msndo75g100byj3p
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-win32-accepted
timestamp: Mon 2009-11-16 14:49:01 -0600
message:
2.1.0b4-win32-test-script was accepted
modified:
bzrlib/tests/script.py script.py-20090901081155-yk3tiy1nunxg16ne-1
bzrlib/tests/test_script.py test_script.py-20090901081156-y90z4w2t62fv7e7b-1
-------------- next part --------------
=== modified file 'bzrlib/tests/script.py'
--- a/bzrlib/tests/script.py 2009-09-24 06:53:43 +0000
+++ b/bzrlib/tests/script.py 2009-11-08 20:28:36 +0000
@@ -217,7 +217,8 @@
# Specifying None means: any output is accepted
return
if actual is None:
- test_case.fail('Unexpected: %s' % actual)
+ test_case.fail('We expected output: %r, but found None'
+ % (expected,))
matching = self.output_checker.check_output(
expected, actual, self.check_options)
if not matching:
@@ -289,30 +290,31 @@
try:
inputs.append(self._read_input(None, in_name))
except IOError, e:
- if e.errno == errno.ENOENT:
+ # Some filenames are illegal on Windows and generate EINVAL
+ # rather than just saying the filename doesn't exist
+ if e.errno in (errno.ENOENT, errno.EINVAL):
return (1, None,
'%s: No such file or directory\n' % (in_name,))
+ raise
# Basically cat copy input to output
output = ''.join(inputs)
# Handle output redirections
try:
output = self._write_output(output, out_name, out_mode)
except IOError, e:
- if e.errno == errno.ENOENT:
+ # If out_name cannot be created, we may get 'ENOENT', however if
+ # out_name is something like '', we can get EINVAL
+ if e.errno in (errno.ENOENT, errno.EINVAL):
return 1, None, '%s: No such file or directory\n' % (out_name,)
+ raise
return 0, output, None
def do_echo(self, test_case, input, args):
(in_name, out_name, out_mode, args) = _scan_redirection_options(args)
- if input and args:
- raise SyntaxError('Specify parameters OR use redirection')
+ if input or in_name:
+ raise SyntaxError('echo doesn\'t read from stdin')
if args:
input = ' '.join(args)
- try:
- input = self._read_input(input, in_name)
- except IOError, e:
- if e.errno == errno.ENOENT:
- return 1, None, '%s: No such file or directory\n' % (in_name,)
# Always append a \n'
input += '\n'
# Process output
@@ -321,8 +323,9 @@
try:
output = self._write_output(output, out_name, out_mode)
except IOError, e:
- if e.errno == errno.ENOENT:
+ if e.errno in (errno.ENOENT, errno.EINVAL):
return 1, None, '%s: No such file or directory\n' % (out_name,)
+ raise
return 0, output, None
def _get_jail_root(self, test_case):
=== modified file 'bzrlib/tests/test_script.py'
--- a/bzrlib/tests/test_script.py 2009-09-17 14:15:15 +0000
+++ b/bzrlib/tests/test_script.py 2009-11-08 20:28:36 +0000
@@ -262,14 +262,6 @@
2>: No such file or directory
""")
- def test_echo_bogus_input_file(self):
- # We need a backing file sysytem for that test so it can't be in
- # TestEcho
- self.run_script("""
-$ echo <file
-2>file: No such file or directory
-""")
-
def test_echo_bogus_output_file(self):
# We need a backing file sysytem for that test so it can't be in
# TestEcho
@@ -338,6 +330,11 @@
"""
self.assertRaises(SyntaxError, self.run_script, story)
+ def test_echo_input(self):
+ self.assertRaises(SyntaxError, self.run_script, """
+ $ echo <foo
+ """)
+
def test_echo_to_output(self):
retcode, out, err = self.run_command(['echo'], None, '\n', None)
self.assertEquals('\n', out)
More information about the bazaar-commits
mailing list