Skip to content

Use of _getframe in get_caller_module_locals (without being able to specify depth) can be problematic #464

Closed
@cvahid-nih

Description

@cvahid-nih

Hello,

First I would like to thank all the maintainers for working on this project, it has been very helpful for our organization, thank you.

I am playing with adding intermediate decorators and wrappers for the step_type functions (when, then, and given) to improve convenience but if I call them from a function inside the steps.py, the step function is not found because the stack frame retrieved by sys._getframe is not the one for the module steps.py which is where the fixtures (and thereby steps) are looked for, so the step gets added to the incorrect f_locals (the function I am calling the step_type from). I was wondering if there is any plan to open up the depth option to be more accessable for situations like this? Or, better yet, maybe avoid this mechanism all together (maybe find the module steps.py some other way).

Thanks

caller_locals = get_caller_module_locals()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions