From 55334dacea024bfd64cc7feb7f1f84302214dadb Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Fri, 15 Mar 2019 21:14:42 +0100 Subject: [PATCH] 1.6.1 Made the python 3 signature patch more readable... for those users who will enter in the code while debugging. --- docs/changelog.md | 4 ++++ pytest_steps/steps.py | 16 ++++------------ pytest_steps/steps_parametrizer.py | 10 ++-------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index dafccae..ae40f33 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,9 @@ # Changelog +### 1.6.1 - Minor code improvements + +Made the python 3 signature patch more readable... for those users who will enter in the code while debugging. + ### 1.6.0 - Minor dependencies update Improved docstring for `@cross_steps_fixture`. diff --git a/pytest_steps/steps.py b/pytest_steps/steps.py index b84e32d..6110e80 100644 --- a/pytest_steps/steps.py +++ b/pytest_steps/steps.py @@ -23,18 +23,10 @@ # Python 3+: load the 'more explicit api' for `test_steps` if version_info >= (3, 0): - - test_steps_full_sig = """ -def _test_steps(*steps, - mode: str = TEST_STEP_MODE_AUTO, - test_step_argname: str = TEST_STEP_ARGNAME_DEFAULT, - steps_data_holder_name: str = STEPS_DATA_HOLDER_NAME_DEFAULT): - pass - -""" - exec(test_steps_full_sig, globals(), locals()) - _test_steps = locals()['_test_steps'] - new_sig = signature(_test_steps) + new_sig = """(*steps, + mode: str = TEST_STEP_MODE_AUTO, + test_step_argname: str = TEST_STEP_ARGNAME_DEFAULT, + steps_data_holder_name: str = STEPS_DATA_HOLDER_NAME_DEFAULT)""" else: new_sig = None diff --git a/pytest_steps/steps_parametrizer.py b/pytest_steps/steps_parametrizer.py index 6dfb6b3..7ae22a9 100644 --- a/pytest_steps/steps_parametrizer.py +++ b/pytest_steps/steps_parametrizer.py @@ -235,14 +235,8 @@ def _execute_manually(test_func, s, test_step_argname, all_step_ids, all_steps, # Python 3+: load the 'more explicit api' for `test_steps` if version_info >= (3, 0): - depends_on_full_sig = """ -def _depends_on(*steps, - fail_instead_of_skip: bool = _FAIL_INSTEAD_OF_SKIP_DEFAULT): - pass -""" - exec(depends_on_full_sig, globals(), locals()) - _depends_on = locals()['_depends_on'] - new_sig = signature(_depends_on) + new_sig = """(*steps, + fail_instead_of_skip: bool = _FAIL_INSTEAD_OF_SKIP_DEFAULT)""" else: new_sig = None