Skip to content

Commit 6ecaf32

Browse files
committed
Add skip message to reports
Signed-off-by: sschulz92 <[email protected]>
1 parent 7de2380 commit 6ecaf32

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

getgauge/exceptions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
class SkipScenarioException(Exception):
2-
"""Custom exception to skip a scenario."""
3-
pass
2+
def __init__(self, message):
3+
super().__init__(message)
4+
self.message = message

getgauge/executor.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import traceback
66

77
from getgauge.exceptions import SkipScenarioException
8-
from getgauge.messages.messages_pb2 import ExecutionStatusResponse, Message
8+
from getgauge.messages.messages_pb2 import ExecutionStatusResponse
99
from getgauge.messages.spec_pb2 import ProtoExecutionResult
10-
from getgauge.registry import MessagesStore, ScreenshotsStore, registry
10+
from getgauge.registry import MessagesStore, ScreenshotsStore
1111

1212

1313
def create_execution_status_response():
@@ -24,24 +24,27 @@ def run_hook(request, hooks, execution_info):
2424
return response
2525

2626

27-
def _false(func, exception): return False
27+
def _false(func, exception):
28+
return False
2829

2930

3031
def execute_method(params, step, response, is_continue_on_failure=_false):
3132
start = _current_time()
3233
try:
3334
params = _get_args(params, step)
3435
step.impl(*params)
35-
except SkipScenarioException:
36+
except SkipScenarioException as e:
3637
response.executionResult.skipScenario = True
38+
MessagesStore.write_message(str(e))
3739
except Exception as e:
3840
_add_exception(e, response, is_continue_on_failure(step.impl, e))
3941
response.executionResult.executionTime = _current_time() - start
4042
response.executionResult.message.extend(MessagesStore.pending_messages())
4143
response.executionResult.screenshotFiles.extend(ScreenshotsStore.pending_screenshots())
4244

4345

44-
def _current_time(): return int(round(time.time() * 1000))
46+
def _current_time():
47+
return int(round(time.time() * 1000))
4548

4649

4750
def _get_args(params, hook_or_step):
@@ -60,7 +63,7 @@ def _add_exception(e, response, continue_on_failure):
6063
screenshot = ScreenshotsStore.capture_to_file()
6164
response.executionResult.failureScreenshotFile = screenshot
6265
response.executionResult.failed = True
63-
message = e.__str__()
66+
message = str(e)
6467
if not message:
6568
message = "Exception occurred"
6669
response.executionResult.errorMessage = message

python.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "python",
3-
"version": "0.4.6",
3+
"version": "0.4.7",
44
"description": "Python support for gauge",
55
"run": {
66
"windows": [

0 commit comments

Comments
 (0)