Last active
August 12, 2016 06:24
-
-
Save brycepg/b10de7804c77f547ba3b6a32aad94e24 to your computer and use it in GitHub Desktop.
Return Report of Procedural Functions using Decorators in Python
In the final version I pack the decorated functions return value, along with TestInfo object on return, if the decorated functions return value isn't None
.
In this simplified version, I use the repr
for readability in iPython. I need the TestInfo
object to be returned even if there is a success to affirm that all functions were called without an exception.
I'm not sure how making the decorator a class will help. I need TestInfo
to be a value-object returned to the caller to do analysis(this example is a proof of concept). I can define TestInfo
class inside the decorator function exc_info
however, which I think makes logical sense since nowhere else does it need to be used.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is an example of what I mean for the first comment