2 new revisions:

Revision: 8331a0057611
Branch:   default
Author:   Pekka Klärck
Date:     Mon Jun 10 13:32:28 2013
Log:      Process: Renamed `Process Is Running` -> `Is Process Running`.
http://code.google.com/p/robotframework/source/detail?r=8331a0057611

Revision: c72a1f66e2ab
Branch:   default
Author:   Pekka Klärck
Date:     Mon Jun 10 13:42:20 2013
Log:      Process: renamed `result.exit_code` -> `result.rc`
http://code.google.com/p/robotframework/source/detail?r=c72a1f66e2ab

==============================================================================
Revision: 8331a0057611
Branch:   default
Author:   Pekka Klärck
Date:     Mon Jun 10 13:32:28 2013
Log:      Process: Renamed `Process Is Running` -> `Is Process Running`.
http://code.google.com/p/robotframework/source/detail?r=8331a0057611

Modified:
 /atest/testdata/standard_libraries/process/is_process_alive.txt
 /atest/testdata/standard_libraries/process/resource.txt
 /atest/testdata/standard_libraries/process/terminate_and_pid.txt
 /atest/testdata/standard_libraries/process/test_process_library.txt
 /src/robot/libraries/Process.py

=======================================
--- /atest/testdata/standard_libraries/process/is_process_alive.txt Mon Jun 10 01:45:34 2013 +++ /atest/testdata/standard_libraries/process/is_process_alive.txt Mon Jun 10 13:32:28 2013
@@ -5,13 +5,17 @@

 *** Test Cases ***
 No Process Should Fail
- Run Keyword And Expect Error No started processes. Process Is Running + Run Keyword And Expect Error No started processes. Is Process Running

 Test Process Should Be Alive
     ${handle}=    Some process
     Process Should Be Running    ${handle}
+    ${running} =    Is Process Running
+    Should Be Equal    ${running}    ${TRUE}
     Stop some process
     Wait For Process    ${handle}
+    ${running} =    Is Process Running
+    Should Be Equal    ${running}    ${FALSE}
Run Keyword And Expect Error Process is not running. Process Should Be Running ${handle}

 Test Process Should Be Dead
=======================================
--- /atest/testdata/standard_libraries/process/resource.txt Mon Jun 10 09:13:28 2013 +++ /atest/testdata/standard_libraries/process/resource.txt Mon Jun 10 13:32:28 2013
@@ -7,7 +7,7 @@
 Stop some process
     [Arguments]    ${alias}=${null}
     ${process}=    Get Process Object   ${alias}
-    Log   ${process.communicate("stop\n")}
+    Call Method    ${process}    communicate    stop\n

 Result should equal
     [Arguments]    ${result}    ${stdout}=    ${stderr}=    ${exit_code}=0
@@ -20,7 +20,6 @@
     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/terminate_and_pid.txt Wed Jun 5 23:25:14 2013 +++ /atest/testdata/standard_libraries/process/terminate_and_pid.txt Mon Jun 10 13:32:28 2013
@@ -14,8 +14,7 @@

 Killing process
     ${handle}=    Some process
-    ${is_alive}=    Process Is Running    ${handle}
-    Should Be True    ${is_alive}
+    Process Should Be Running
     Terminate Process    ${handle}    kill=${True}
     Wait For Process    ${handle}
     Process Should Be Stopped    ${handle}
=======================================
--- /atest/testdata/standard_libraries/process/test_process_library.txt Mon Jun 10 09:13:28 2013 +++ /atest/testdata/standard_libraries/process/test_process_library.txt Mon Jun 10 13:32:28 2013
@@ -21,8 +21,7 @@

 Start And Wait Process
     ${handle}=    Start Python Process    import time;time.sleep(0.1)
-    ${is_alive}=    Process Is Running    ${handle}
-    Should Be True    ${is_alive}
+    Process Should Be Running    ${handle}
     Wait For Process    ${handle}
     Process Should Be Stopped    ${handle}

@@ -161,7 +160,7 @@

 *** Keywords ***
 Restart Suite Process If Needed
-    ${alive}=    Process Is Running    suite_process
+    ${alive}=    Is Process Running    suite_process
     Run Keyword Unless    ${alive}    Some process    suite_process

 Suite Setup
=======================================
--- /src/robot/libraries/Process.py     Mon Jun 10 09:13:28 2013
+++ /src/robot/libraries/Process.py     Mon Jun 10 13:32:28 2013
@@ -321,8 +321,7 @@
             return subprocess.list2cmdline(command)
         return command[0]

-    # TODO: process_is_running vs is_process_running
-    def process_is_running(self, handle=None):
+    def is_process_running(self, handle=None):
         """Checks is the process running or not.

         If `handle`is not given, uses the current `active process`.
@@ -339,7 +338,7 @@

         Fails if the process has stopped.
         """
-        if not self.process_is_running(handle):
+        if not self.is_process_running(handle):
             raise AssertionError(error_message)

     def process_should_be_stopped(self, handle=None,
@@ -350,7 +349,7 @@

         Fails if the process is still running.
         """
-        if self.process_is_running(handle):
+        if self.is_process_running(handle):
             raise AssertionError(error_message)

     def wait_for_process(self, handle=None):
@@ -419,7 +418,7 @@
         See `Stopping processes` for more details.
         """
         for handle in range(len(self._started_processes._connections)):
-            if self.process_is_running(handle):
+            if self.is_process_running(handle):
                 self.terminate_process(handle, kill=kill)

     def get_process_id(self, handle=None):

==============================================================================
Revision: c72a1f66e2ab
Branch:   default
Author:   Pekka Klärck
Date:     Mon Jun 10 13:42:20 2013
Log:      Process: renamed `result.exit_code` -> `result.rc`
http://code.google.com/p/robotframework/source/detail?r=c72a1f66e2ab

Modified:
 /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/testdata/standard_libraries/process/resource.txt Mon Jun 10 13:32:28 2013 +++ /atest/testdata/standard_libraries/process/resource.txt Mon Jun 10 13:42:20 2013
@@ -10,16 +10,16 @@
     Call Method    ${process}    communicate    stop\n

 Result should equal
-    [Arguments]    ${result}    ${stdout}=    ${stderr}=    ${exit_code}=0
+    [Arguments]    ${result}    ${stdout}=    ${stderr}=    ${rc}=0
     Should Be Equal    ${result.stdout}    ${stdout}
     Should Be Equal    ${result.stderr}    ${stderr}
-    Should Be Equal As Integers    ${result.exit_code}    ${exit_code}
+    Should Be Equal As Integers    ${result.rc}    ${rc}

 Result should match
-    [Arguments]    ${result}    ${stdout}=    ${stderr}=    ${exit_code}=0
+    [Arguments]    ${result}    ${stdout}=    ${stderr}=    ${rc}=0
     Should Match    ${result.stdout}    ${stdout}
     Should Match    ${result.stderr}    ${stderr}
-    Should Be Equal As Integers    ${result.exit_code}    ${exit_code}
+    Should Be Equal As Integers    ${result.rc}    ${rc}

 Start Python Process
     [Arguments]    ${command}    ${alias}=${null}
@@ -29,6 +29,6 @@
 Run Python Process
     [Arguments]    ${command}
     ${result}=    Run Process    python    -c    ${command}
-    Log    ${result.exit_code}
+    Log    ${result.rc}
     Log    ${result.stderr}
     [Return]    ${result}
=======================================
--- /atest/testdata/standard_libraries/process/test_newlines_and_encoding.txt Mon Jun 10 09:13:28 2013 +++ /atest/testdata/standard_libraries/process/test_newlines_and_encoding.txt Mon Jun 10 13:42:20 2013
@@ -7,20 +7,20 @@
 *** Test Cases ***
 Non-ascii in the command using shell=True
     ${result}=   Run Process    python -c "print 'ööåöåöå'"   shell=True
-    Result should equal    ${result}    stdout=ööåöåöå   exit_code=0
+    Result should equal    ${result}    stdout=ööåöåöå

 Non-ascii in the command using shell=False
     ${result}=   Run Process    python   -c     print "ööåöåöå"
-    Result should equal    ${result}    stdout=ööåöåöå   exit_code=0
+    Result should equal    ${result}    stdout=ööåöåöå

 Non-ascii in the command with given stdout
${result}= Run Process python -c print "ööåöåöå" shell=True stdout=myfile.txt
-    Result should equal    ${result}    stdout=ööåöåöå   exit_code=0
+    Result should equal    ${result}    stdout=ööåöåöå
     [Teardown]   Run Keyword And Ignore Error   Remove File   myfile.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 + 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
@@ -28,11 +28,11 @@

 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

 Newline test using shell=False
     ${result}=   Run Process    python  -c   print "hello"
-    Result should equal    ${result}    stdout=hello   exit_code=0
+    Result should equal    ${result}    stdout=hello

 *** Keywords ***
 Check Preconditions
=======================================
--- /atest/testdata/standard_libraries/process/test_process_library.txt Mon Jun 10 13:32:28 2013 +++ /atest/testdata/standard_libraries/process/test_process_library.txt Mon Jun 10 13:42:20 2013
@@ -13,11 +13,11 @@

 Running a process
${result}= Run Python Process import sys; sys.stdout.write('hello')
-    Result should equal    ${result}    stdout=hello   exit_code=0
+    Result should equal    ${result}    stdout=hello

 Error in exit code and stderr output
     ${result}=    Run Python Process    1/0
- Result should match ${result} stderr=*ZeroDivisionError: integer division or modulo by zero* exit_code=1 + Result should match ${result} stderr=*ZeroDivisionError: integer division or modulo by zero* rc=1

 Start And Wait Process
     ${handle}=    Start Python Process    import time;time.sleep(0.1)
@@ -98,7 +98,7 @@

 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
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 13:32:28 2013
+++ /src/robot/libraries/Process.py     Mon Jun 10 13:42:20 2013
@@ -206,20 +206,18 @@
     What is available is documented in the table below.

     | *Attribute* | *Explanation*                                 |
+    | rc          | Return code of the process as an integer.     |
     | stdout      | Contents of the standard output stream.       |
     | stderr      | Contents of the standard error stream.        |
     | stdout_path | Path of the file where stdout was redirected. |
     | stderr_path | Path of the file where stderr was redirected. |
-    | exit_code   | Return code of the process.                   |

     TODO:
     - value of stdxxx_path when no redirection?
-    - is exit_code integer or string? can it be None?
-    - why exit_code and not return_core or rc?

     Example:
| ${result} = | `Run Process` | program | - | `Log` | ${result.exit_code} | | + | `Should Be Equal As Integers` | ${result.rc} | | | `Should Match` | ${result.stdout} | Some t?xt* | | `Should Be Empty` | ${result.stderr} | | | ${stdout} = | `Get File` | ${result.stdout_path} |
@@ -257,9 +255,7 @@
     |     `Should Not Contain`    ${result.stdout}    FAIL
     |     `Terminate Process`    ${handle}
     |     ${result} =    `Wait For Process`    First
-    |     Should Be Equal    ${result.exit_code}    0
-
-    TODO: Is the above exit_code check ok?
+    |     `Should Be Equal As Integers`   ${result.rc}    0
     """
     ROBOT_LIBRARY_SCOPE = 'GLOBAL'
     ROBOT_LIBRARY_VERSION = get_version()
@@ -362,7 +358,7 @@
         process = self._process(handle)
         result = self._results[process]
         logger.info('Waiting for process to complete.')
-        result.exit_code = process.wait()
+        result.rc = process.wait() or 0
         logger.info('Process completed.')
         return result

@@ -465,11 +461,11 @@
 class ExecutionResult(object):
     _stdout = _stderr = _process = None

-    def __init__(self, process, stdout, stderr, exit_code=None):
+    def __init__(self, process, stdout, stderr, rc=None):
         self._process = process
         self.stdout_path = self._construct_stdout_path(stdout)
         self.stderr_path = self._construct_stderr_path(stderr)
-        self.exit_code = exit_code
+        self.rc = rc

     def _construct_stdout_path(self, stdout):
         return stdout.name if stdout != subprocess.PIPE else None
@@ -516,7 +512,7 @@
         return """\
 stdout_name : %s
 stderr_name : %s
-exit_code   : %d""" % (self.stdout_path, self.stderr_path, self.exit_code)
+exit_code   : %d""" % (self.stdout_path, self.stderr_path, self.rc)


 class ProcessConfig(object):

--

--- 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.


Reply via email to