Skip to content

Commit de52864

Browse files
committed
more nested step tests
1 parent 8616332 commit de52864

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

reportportal_client/steps/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __enter__(self):
120120
"""Enter the runtime context related to this object."""
121121
# Cannot call _local.current() early since it will be initialized
122122
# before client put something in there
123-
rp_client = self.client if self.client else current()
123+
rp_client = self.client or current()
124124
if not rp_client:
125125
return
126126
self.__item_id = rp_client.step_reporter \
@@ -138,7 +138,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
138138
"""Exit the runtime context related to this object."""
139139
# Cannot call _local.current() early since it will be initialized
140140
# before client put something in there
141-
rp_client = self.client if self.client else current()
141+
rp_client = self.client or current()
142142
if not rp_client:
143143
return
144144
# Avoid failure in case if 'rp_client' was 'None' on function start

tests/steps/test_steps.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,12 @@ def test_two_level_nested_step_decorator(rp_client):
194194
assert first_id.startswith('post-')
195195
assert second_id.startswith('post-')
196196
assert first_id != second_id
197+
198+
199+
def test_verify_manual_client_bypass_step(rp_client):
200+
set_current(None)
201+
rp_client._item_stack.append(PARENT_STEP_ID)
202+
with step(NESTED_STEP_NAME, rp_client=rp_client):
203+
pass
204+
assert rp_client.session.post.call_count == 1
205+
assert rp_client.session.put.call_count == 1

0 commit comments

Comments
 (0)