I'm using Behave as a python framework for testing. One of the necessary functions of Behave is def step_imp(context): but when I run pre-commit, I get loads of the following messages:
E0102: function already defined line 26 (function-redefined)
I can't redefine this function, so is there a way to exclude this message specifically for the "step-imp" function?
31 Answer
The information you provide is not enough to solve the problem.
Can you show the minimum example that reproduces this problem?
When using behave, although it is true that the name of all the functions is the same, they are differentiated by their tag, which avoids any error related to having several functions with the same name.
Example: steps/steps.py
from behave import * @given("This is one step") def step_impl(context): print("I'm executing this code??") @given("this is other setp") def step_impl(context): print("or I'm executing this other code??") As we can see, both methods have the same name but different tag, so for practical purposes they are different functions. If several of them share the same tag, we would have a duplicate.