Revision: 6e4bcda37a04
Branch: default
Author: Mika Hänninen <mika.hanni...@gmail.com>
Date: Mon Jun 10 09:13:28 2013
Log: process lib: test tweaks
http://code.google.com/p/robotframework/source/detail?r=6e4bcda37a04
Modified:
/atest/robot/standard_libraries/process/test_newlines_and_encoding.txt
/atest/testdata/standard_libraries/process/resource.txt
/atest/testdata/standard_libraries/process/test_newlines_and_encoding.txt
/atest/testdata/standard_libraries/process/test_process_library.txt
/src/robot/libraries/Process.py
=======================================
--- /atest/robot/standard_libraries/process/test_newlines_and_encoding.txt
Mon Jun 10 05:47:50 2013
+++ /atest/robot/standard_libraries/process/test_newlines_and_encoding.txt
Mon Jun 10 09:13:28 2013
@@ -14,7 +14,7 @@
Non-ascii in the command with given stdout
Check Test Case ${TESTNAME}
-Ascii characters in output with dir command
+Newlines and trailing newline is removed
Check Test Case ${TESTNAME}
Non-ascii in the command arguments
=======================================
--- /atest/testdata/standard_libraries/process/resource.txt Tue May 14
01:14:23 2013
+++ /atest/testdata/standard_libraries/process/resource.txt Mon Jun 10
09:13:28 2013
@@ -10,10 +10,17 @@
Log ${process.communicate("stop\n")}
Result should equal
+ [Arguments] ${result} ${stdout}= ${stderr}= ${exit_code}=0
+ Should Be Equal ${result.stdout} ${stdout}
+ Should Be Equal ${result.stderr} ${stderr}
+ Should Be Equal As Integers ${result.exit_code} ${exit_code}
+
+Result should match
[Arguments] ${result} ${stdout}= ${stderr}= ${exit_code}=0
Should Match ${result.stdout} ${stdout}
Should Match ${result.stderr} ${stderr}
Should Be Equal As Integers ${result.exit_code} ${exit_code}
+
Start Python Process
[Arguments] ${command} ${alias}=${null}
=======================================
---
/atest/testdata/standard_libraries/process/test_newlines_and_encoding.txt
Mon Jun 10 06:28:18 2013
+++
/atest/testdata/standard_libraries/process/test_newlines_and_encoding.txt
Mon Jun 10 09:13:28 2013
@@ -18,10 +18,9 @@
Result should equal ${result} stdout=ööåöåöå exit_code=0
[Teardown] Run Keyword And Ignore Error Remove File myfile.txt
-Ascii characters in output with dir command
- ${result}= Run Process python -c "import os,pprint;
pprint.pprint(os.listdir('.'));" shell=True stdout=dirlist.txt
cwd=${CURDIR}
- Log ${result.stdout}
- [Teardown] Run Keyword And Ignore Error Remove File dirlist.txt
+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 exit_code=0
Non-ascii in the command arguments
${result}= Run Process python -c "import os; print
os.getenv('varri', '-');" shell=True env:varri=Öoa
@@ -29,7 +28,7 @@
Newline test using shell=True
${result}= Run Process python -c "print 'hello'" shell=True
- Result should equal ${result} stdout=*hello* exit_code=0
+ Result should equal ${result} stdout=hello exit_code=0
Newline test using shell=False
${result}= Run Process python -c print "hello"
=======================================
--- /atest/testdata/standard_libraries/process/test_process_library.txt Mon
Jun 10 05:39:20 2013
+++ /atest/testdata/standard_libraries/process/test_process_library.txt Mon
Jun 10 09:13:28 2013
@@ -17,7 +17,7 @@
Error in exit code and stderr output
${result}= Run Python Process 1/0
- Result should equal ${result} stderr=*ZeroDivisionError: integer
division or modulo by zero* exit_code=1
+ Result should match ${result} stderr=*ZeroDivisionError: integer
division or modulo by zero* exit_code=1
Start And Wait Process
${handle}= Start Python Process import time;time.sleep(0.1)
@@ -46,14 +46,14 @@
${result}= Run Process python -c "print 'hello'"
shell=True stdout=${TEMPDIR}${/}myfile_1.txt
${output}= Get File ${TEMPDIR}${/}myfile_1.txt
Should Not Be Empty ${output}
- Should Be Equal ${result.stdout} ${output}
+ Should Match ${output} ${result.stdout}*
[Teardown] Run Keyword And Ignore Error Remove File
${TEMPDIR}${/}myfile_1.txt
Setting Stderr
${result}= Run Process python -c "1/0" shell=True
stderr=${TEMPDIR}${/}myfile.txt
${output}= Get File ${TEMPDIR}${/}myfile.txt
Should Not Be Empty ${output}
- Should Be Equal ${result.stderr} ${output}
+ Should Match ${output} ${result.stderr}*
[Teardown] Run Keyword And Ignore Error Remove File
${TEMPDIR}${/}myfile.txt
Without Env Configuration the Environment Should Be As It Was
@@ -95,11 +95,11 @@
Escaping equals sign
${result}= Run Process python -c
print 'stderr\=bar.buu' shell=True
- Result should equal ${result} stdout=*stderr=bar.buu*
+ Result should match ${result} stdout=*stderr=bar.buu*
Running a process in a shell
${result}= Run Process python -c "print 'hello'" shell=True
- Result should equal ${result} stdout=*hello* exit_code=0
+ Result should equal ${result} stdout=hello exit_code=0
Run Keyword And Expect Error * Run Process python
-c "print 'hello'" shell=${False}
Input things to process
=======================================
--- /src/robot/libraries/Process.py Mon Jun 10 06:38:28 2013
+++ /src/robot/libraries/Process.py Mon Jun 10 09:13:28 2013
@@ -486,6 +486,8 @@
def stdout(self):
if self._stdout is None:
self._stdout = self._construct_stdout()
+ if self._stdout.endswith('\n'):
+ self._stdout = self._stdout[:-1]
return self._stdout
def _construct_stdout(self):
@@ -498,6 +500,8 @@
def stderr(self):
if self._stderr is None:
self._stderr = self._construct_stderr()
+ if self._stderr.endswith('\n'):
+ self._stderr = self._stderr[:-1]
return self._stderr
def _construct_stderr(self):
--
---
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 robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.