Skip to content

Commit 55334da

Browse files
author
Sylvain MARIE
committed
1.6.1 Made the python 3 signature patch more readable... for those users who will enter in the code while debugging.
1 parent 41d09d1 commit 55334da

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### 1.6.1 - Minor code improvements
4+
5+
Made the python 3 signature patch more readable... for those users who will enter in the code while debugging.
6+
37
### 1.6.0 - Minor dependencies update
48

59
Improved docstring for `@cross_steps_fixture`.

pytest_steps/steps.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,10 @@
2323

2424
# Python 3+: load the 'more explicit api' for `test_steps`
2525
if version_info >= (3, 0):
26-
27-
test_steps_full_sig = """
28-
def _test_steps(*steps,
29-
mode: str = TEST_STEP_MODE_AUTO,
30-
test_step_argname: str = TEST_STEP_ARGNAME_DEFAULT,
31-
steps_data_holder_name: str = STEPS_DATA_HOLDER_NAME_DEFAULT):
32-
pass
33-
34-
"""
35-
exec(test_steps_full_sig, globals(), locals())
36-
_test_steps = locals()['_test_steps']
37-
new_sig = signature(_test_steps)
26+
new_sig = """(*steps,
27+
mode: str = TEST_STEP_MODE_AUTO,
28+
test_step_argname: str = TEST_STEP_ARGNAME_DEFAULT,
29+
steps_data_holder_name: str = STEPS_DATA_HOLDER_NAME_DEFAULT)"""
3830
else:
3931
new_sig = None
4032

pytest_steps/steps_parametrizer.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,8 @@ def _execute_manually(test_func, s, test_step_argname, all_step_ids, all_steps,
235235

236236
# Python 3+: load the 'more explicit api' for `test_steps`
237237
if version_info >= (3, 0):
238-
depends_on_full_sig = """
239-
def _depends_on(*steps,
240-
fail_instead_of_skip: bool = _FAIL_INSTEAD_OF_SKIP_DEFAULT):
241-
pass
242-
"""
243-
exec(depends_on_full_sig, globals(), locals())
244-
_depends_on = locals()['_depends_on']
245-
new_sig = signature(_depends_on)
238+
new_sig = """(*steps,
239+
fail_instead_of_skip: bool = _FAIL_INSTEAD_OF_SKIP_DEFAULT)"""
246240
else:
247241
new_sig = None
248242

0 commit comments

Comments
 (0)