Skip to content

Commit d8ee496

Browse files
authored
Merge pull request #49 from eficode/docs/utils
README: document utils. Fixes #12
2 parents 5d70867 + e5c4ba7 commit d8ee496

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,19 @@ $
160160
```
161161
Because you can add the configuration to the same handler multiple times, note that only the last entry is in effect.
162162

163+
## `utils` module
164+
165+
In [utils module](https://github.com/eficode/robotframework-oxygen/blob/master/src/oxygen/utils.py), you will find assortment of functionalities that you might want to leverage when writing your own handler.
166+
167+
### `run_command_line()`
168+
169+
Most of the time, handlers want to run the other test tool through command line. For this, `utils` provides `run_command_line()` that wraps Python's [`subprocess`](https://docs.python.org/3/library/subprocess.html) module for more easier to use when writing your handler.
170+
171+
`run_command_line()` takes following arguments:
172+
- `cmd`: the command to be executed in a subprocess
173+
- `check_return_code`: if set to `True`, will raise an exception if the `cmd` fails in the subprocess. **Note** that this fails the keyword and, thus, the execution of the test case is stopped. If you want to enable test case to continue even after `run_command_line()` has failed, you should disable it by setting `False`. It is often a good idea to allow user using your handler's keyword to decide how they want the command line execution to affect the test case
174+
- `env`: a dictionary of environment variables that should be passed to the subprocess. By default, `run_command_line()` inherits the environment from the current Python process as well as from modifications done by the Robot Framework command line arguments (ie. `--pythonpath`)
175+
163176
# Developing Oxygen
164177

165178
Clone the Oxygen repository to the environment where you want to the run the tool.

0 commit comments

Comments
 (0)