2 new revisions:
Revision: e264f5e59f18
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Tue Jan 28 14:24:45 2014 UTC
Log: Process: Fixed non-ASCII args and output with Jython...
http://code.google.com/p/robotframework/source/detail?r=e264f5e59f18
Revision: eb32bbc85c3a
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Tue Jan 28 14:24:54 2014 UTC
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=eb32bbc85c3a
==============================================================================
Revision: e264f5e59f18
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Tue Jan 28 14:24:45 2014 UTC
Log: Process: Fixed non-ASCII args and output with Jython
New issue
Summary: Process library does not support non-ASCII arguments or output
with Jython
Owner: pekka.klarck
Status: Review
Labels: Type-Defect Priority-Medium Target-2.8.4
Using non-ASCII commands/arguments and handling non-ASCII output from
commands
is broken with Jython. Tests for these functionalities were incorrectly
disabled with it. Bugs ought to be fixed now and tests enabled. Need to test
on different operating systems, and on IronPython, before knowing is
everything fine.
http://code.google.com/p/robotframework/source/detail?r=e264f5e59f18
Modified:
/atest/robot/standard_libraries/process/newlines_and_encoding.txt
/atest/testdata/standard_libraries/process/newlines_and_encoding.txt
/src/robot/libraries/Process.py
=======================================
--- /atest/robot/standard_libraries/process/newlines_and_encoding.txt Tue
Jan 28 09:20:00 2014 UTC
+++ /atest/robot/standard_libraries/process/newlines_and_encoding.txt Tue
Jan 28 14:24:45 2014 UTC
@@ -5,19 +5,25 @@
Test Setup Check Precondition
*** Test Cases ***
-Non-ascii in the command using shell=True
+Non-ascii in command using shell=True
Check Test Case ${TESTNAME}
-Non-ascii in the command using shell=False
+Non-ascii in command using shell=False
Check Test Case ${TESTNAME}
-Non-ascii in the command with given stdout
+Non-ascii in command and output using shell=True
Check Test Case ${TESTNAME}
-Newlines and trailing newline is removed
+Non-ascii in command and output using shell=False
Check Test Case ${TESTNAME}
-Non-ascii in the command arguments
+Non-ascii in command and output with given stdout
+ Check Test Case ${TESTNAME}
+
+Non-ascii in environment variables
+ Check Test Case ${TESTNAME}
+
+Newlines and trailing newline is removed
Check Test Case ${TESTNAME}
Newline test using shell=True
=======================================
--- /atest/testdata/standard_libraries/process/newlines_and_encoding.txt
Tue Jan 28 09:20:00 2014 UTC
+++ /atest/testdata/standard_libraries/process/newlines_and_encoding.txt
Tue Jan 28 14:24:45 2014 UTC
@@ -1,30 +1,38 @@
*** Settings ***
Resource resource.txt
-Test Setup Check Precondition sys.version_info >= (2,6)
*** Test Cases ***
-Non-ascii in the command using shell=True
- ${result}= Run Process python -c "print 'ööåöåöå'" shell=True
- Result should equal ${result} stdout=ööåöåöå
+Non-ascii in command using shell=True
+ ${result}= Run Process python -c "print repr('ä')" shell=True
+ Result should equal ${result} stdout='\\xc3\\xa4'
-Non-ascii in the command using shell=False
- ${result}= Run Process python -c print "ööåöåöå"
- Result should equal ${result} stdout=ööåöåöå
+Non-ascii in command using shell=False
+ ${result}= Run Process python -c print repr('ä')
+ Result should equal ${result} stdout='\\xc3\\xa4'
-Non-ascii in the command with given stdout
+Non-ascii in command and output using shell=True
+ ${result}= Run Process python -c "print 'ä'" shell=True
+ Result should equal ${result} stdout=ä
+
+Non-ascii in command and output using shell=False
+ ${result}= Run Process python -c print 'ä'
+ Result should equal ${result} stdout=ä
+
+Non-ascii in command and output with given stdout
${path}= Normalize Path %{TEMPDIR}/process-stdout.txt
${result}= Run Process python -c print "ööåöåöå"
shell=True stdout=${path}
Result should equal ${result} stdout=ööåöåöå
[Teardown] Safe Remove File ${path}
+
+Non-ascii in environment variables
+ [Setup] Check Precondition not sys.platform.startswith('java')
+ ${result}= Run Process python -c "import os; print
os.getenv('X_X')" shell=True env:X_X=Öoa
+ Result should equal ${result} stdout=Öoa
Newlines and trailing newline is removed
${result}= Run Process python -c "print 'first line\\nsecond
line\\nthird line'" shell=True cwd=${CURDIR}
Result should equal ${result} stdout=first line\nsecond
line\nthird line
-Non-ascii in the command arguments
- ${result}= Run Process python -c "import os; print
os.getenv('varri', '-');" shell=True env:varri=Öoa
- Should Be Equal ${result.stdout.strip()} Öoa
-
Newline test using shell=True
${result}= Run Process python -c "print 'hello'" shell=True
Result should equal ${result} stdout=hello
=======================================
--- /src/robot/libraries/Process.py Tue Jan 28 09:50:32 2014 UTC
+++ /src/robot/libraries/Process.py Tue Jan 28 14:24:45 2014 UTC
@@ -20,8 +20,7 @@
import signal as signal_module
from robot.utils import (ConnectionCache, abspath, encode_to_system,
- decode_from_system, get_env_vars, secs_to_timestr,
- timestr_to_secs)
+ decode_output, secs_to_timestr, timestr_to_secs)
from robot.version import get_version
from robot.api import logger
@@ -339,7 +338,7 @@
return self._processes.register(process, alias=config.alias)
def _cmd(self, args, command, use_shell):
- command = [encode_to_system(item) for item in [command] +
list(args)]
+ command = [item for item in [command] + list(args)]
if not use_shell:
return command
if args:
@@ -720,7 +719,7 @@
def _format_output(self, output):
if output.endswith('\n'):
output = output[:-1]
- return decode_from_system(output)
+ return decode_output(output)
def __str__(self):
return '<result object with rc %d>' % self.rc
@@ -756,16 +755,13 @@
return self.stdout_stream
return self._new_stream(stderr)
- def _construct_env(self, env, rest):
- for key in rest:
+ def _construct_env(self, env, extra):
+ for key in extra:
if not key.startswith('env:'):
raise RuntimeError("'%s' is not supported by this
keyword." % key)
if env is None:
- env = get_env_vars(upper=False)
- env[key[4:]] = rest[key]
- if env:
- env = dict((encode_to_system(key), encode_to_system(env[key]))
- for key in env)
+ env = os.environ.copy()
+ env[encode_to_system(key[4:])] = encode_to_system(extra[key])
return env
def __str__(self):
==============================================================================
Revision: eb32bbc85c3a
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Tue Jan 28 14:24:54 2014 UTC
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=eb32bbc85c3a
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.