Revision: 7af65771cabe
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Wed Oct 23 13:23:21 2013 UTC
Log: Process: Enhanced docs of `Wait For Process`
Update issue 1481
Status: Done
Implementation and tests look very good. I enhanced the docs and consider
this
done.
http://code.google.com/p/robotframework/source/detail?r=7af65771cabe
Modified:
/src/robot/libraries/Process.py
=======================================
--- /src/robot/libraries/Process.py Wed Oct 23 09:11:45 2013 UTC
+++ /src/robot/libraries/Process.py Wed Oct 23 13:23:21 2013 UTC
@@ -351,37 +351,46 @@
raise AssertionError(error_message)
def wait_for_process(self, handle=None, timeout=None,
on_timeout='none'):
- """Waits for the process to complete or to reach given timeout.
+ """Waits for the process to complete or to reach the given timeout.
- Reaching timeout will not fail tests. Instead the action triggered
- by timeout is configured with `handle_timeout` parameter.
+ The process to wait for must have been started earlier with
+ `Start Process`. If `handle` is not given, uses the current
+ `active process`.
- If `handle` is not given, uses the current `active process`.
+ `timeout` defines the maximum time to wait for the process. It is
+ interpreted according to Robot Framework User Guide Appendix
+ `Time Format`, for example, '42', '42 s', or '1 minute 30 seconds'.
- `timeout` is a string representing time. It is interpreted
- according to Robot Framework User Guide Appendix `Time Format`,
- for example, '42', '42 s', '1 minute 30 seconds'.
+ `on_timeout` defines what to do if the timeout occurs. Possible
values
+ and corresponding actions are explained in the table below. Notice
+ that reaching the timeout never fails the test.
- `on_timeout` is a string specifying what is done to the process
- when the timeout is reached. Possible values are explained below:
+ | = Value = | = Action = |
+ | `none` | The process is left running (default). |
+ | `terminate` | The process is gracefully terminated. |
+ | `kill` | The process is forcefully stopped. |
- | = Value = | = Action
= |
- | `none` | The process is left running and returncode set to
None |
- | `terminate` | The process is gracefully
terminated |
- | `kill` | The process is forcefully
stopped |
-
- See `Terminate Process` documentation on how termination and
killing
- processes are handled.
+ See `Terminate Process` keyword for more details how processes are
+ terminated and killed.
- Returns a `result object` containing information about the
execution.
+ If the process ends before the timeout or it is terminated or
killed,
+ this keyword returns a `result object` containing information about
+ the execution. If the process is left running, Python `None` is
+ returned instead.
Examples:
- | `Start Process` | non-finishing-process |
- | `Wait For Process` | timeout=30s |
on_timeout='none' |
- | `Process Should Be Running` |
- | ${result} = | `Wait For Process` |
timeout=1m30s | on_timeout='kill' |
- | `Process Should Be Stopped` |
- | `Should Be Equal As Integers` | ${result.rc} |
-9 |
+ | # Process ends cleanly |
| |
+ | ${result} = | `Wait For Process` |
example |
+ | `Process Should Be Stopped` | example
| |
+ | `Should Be Equal As Integers` | ${result.rc} |
0 |
+ | # Process does not end |
| |
+ | ${result} = | `Wait For Process` | timeout=42
secs |
+ | `Process Should Be Running` |
| |
+ | `Should Be Equal` | ${result} |
${NONE} |
+ | # Kill non-ending process |
| |
+ | ${result} = | `Wait For Process` |
timeout=1min 30s | on_timeout=kill |
+ | `Process Should Be Stopped` |
| |
+ | `Should Be Equal As Integers` | ${result.rc} |
-9 |
`timeout` and `on_timeout` are new in Robot Framework 2.8.2.
"""
--
---
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.