We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I was wondering if its possible to inject decorators to expanded functions.
# this won't work @inject_a_flag_to_setup @parameterized.expand([1,2,3]) def foo(x): return x
# suggestion @parameterized.expand([1,2,3], decorators=[inject_a_flag_to_setup]) def foo(x): return x
to become
@inject_a_flag_to_setup def foo_1_1(x): return x @inject_a_flag_to_setup def foo_2_2(x): return x @inject_a_flag_to_setup def foo_3_3(x): return x
The text was updated successfully, but these errors were encountered:
does any one know a way to do that?
Sorry, something went wrong.
I manage to have this working with this:
def setup(f: Callable): def _f(self, some_arg: str): self.some_function_from_my_test_class() return f(self, some_arg) _f.__name__ = f.__name__ _f.__annotations__ = f.__annotations__ _f.__docs__ = getattr(f, "__docs__", "") return _f
for some reason it didn't work with functools.wraps, what would be much better
and I call it with:
class MyTestCase(TestCase): @parameterized.expand(LIST_OF_INPUTS) @setup def test_my_func(self, some_arg: str) -> None: ...
No branches or pull requests
I was wondering if its possible to inject decorators to expanded functions.
to become
The text was updated successfully, but these errors were encountered: