-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an improved test_function_new decorator to pytest_extensions
The `pytest_extensions.test_function` decorator is signature-preserving. This causes the decorated test functions to have unused arguments, and access to the `kwargs` dict in the test function needs to by key access to the `kwargs` dict, causing extra code in the test functions. This change introduces a `pytest_extensions.test_function_new` decorator with an improved interface for the test functions which now get the testcase tuple as a named tuple, and the `kwargs` dict of the testcase as expanded keyword arguments. Note that the new decorator needs to explicitly set the __signature__ attribute of the test function, because of a specific pytest default behavior of using the signature of the unpacked wrapped function. See also pytest issue #3435. Signed-off-by: Andreas Maier <maiera@de.ibm.com>
- Loading branch information
1 parent
a62b13e
commit 4bb7b5e
Showing
5 changed files
with
402 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.