Commit 7e18eb4edaf65a2574dff34fdc12d512b3878b9d
1 parent
ed8a3dbe
Upd. `Run keyword and ignore keyword definitions`
Showing
1 changed file
with
12 additions
and
16 deletions
@@ -193,27 +193,23 @@ def prepare_test_tender_data(procedure_intervals, mode): | @@ -193,27 +193,23 @@ def prepare_test_tender_data(procedure_intervals, mode): | ||
193 | raise ValueError("Invalid mode for prepare_test_tender_data") | 193 | raise ValueError("Invalid mode for prepare_test_tender_data") |
194 | 194 | ||
195 | 195 | ||
196 | -def run_keyword_and_ignore_keyword_definitions(name, *args): | ||
197 | - """Runs the given keyword with given arguments and returns the status as a Boolean value. | 196 | +def run_keyword_and_ignore_keyword_definitions(name, *args, **kwargs): |
197 | + """This keyword is pretty similar to `Run Keyword And Ignore Error`, | ||
198 | + which, unfortunately, does not suppress the error when you try | ||
199 | + to use it to run a keyword which is not defined. | ||
200 | + As a result, the execution of its parent keyword / test case is aborted. | ||
198 | 201 | ||
199 | - This keyword returns `True` if the keyword that is executed succeeds and | ||
200 | - `False` if it fails. This is useful, for example, in combination with | ||
201 | - `Run Keyword If`. If you are interested in the error message or return | ||
202 | - value, use `Run Keyword And Ignore Error` instead. | 202 | + How this works: |
203 | 203 | ||
204 | - The keyword name and arguments work as in `Run Keyword`. | ||
205 | - | ||
206 | - Example: | ||
207 | - | ${passed} = | `Run Keyword And Return Status` | Keyword | args | | ||
208 | - | `Run Keyword If` | ${passed} | Another keyword | | ||
209 | - | ||
210 | - New in Robot Framework 2.7.6. | 204 | + This is a simple wrapper for `Run Keyword And Ignore Error`. |
205 | + It handles the error mentioned above and additionally provides | ||
206 | + a meaningful error message. | ||
211 | """ | 207 | """ |
212 | try: | 208 | try: |
213 | - status, _ = BuiltIn().run_keyword_and_ignore_error(name, *args) | 209 | + status, _ = BuiltIn().run_keyword_and_ignore_error(name, *args, **kwargs) |
214 | except HandlerExecutionFailed: | 210 | except HandlerExecutionFailed: |
215 | - LOGGER.log_message(Message("Keyword {} not implemented", "ERROR")) | ||
216 | - return "FAIL", "" | 211 | + LOGGER.log_message(Message("Keyword is not implemented: {}".format(name), "ERROR")) |
212 | + status, _ = "FAIL", None | ||
217 | return status, _ | 213 | return status, _ |
218 | 214 | ||
219 | 215 |
Please
register
or
login
to post a comment