-
Notifications
You must be signed in to change notification settings - Fork 117
[refactor] Add a powerful repr() function for debugging
#1410
New issue
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
[refactor] Add a powerful repr() function for debugging
#1410
Conversation
This function replaces the older `debug.repr()` and uses `util.ppretty()` for nicely printing the object attributes. `util.ppretty()` is also extended in order to recursively call the new `repr()` function. Objects are printed only once by this new `repr()` avoiding infinite recursions. Finally, we use that function to print the whole ReFrame runtime state in case issue reframe-hpc#1369 appears. This function does not take into account the `__slots__` for the moment. In cases, where an object does not have a `__dict__` attribute, the builtin `repr()` will be used.
|
Check comment in issue #1369 as a proof that this PR works wonderfully :-) It served its purpose already! |
ekouts
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Codecov Report
@@ Coverage Diff @@
## master #1410 +/- ##
=======================================
Coverage 91.79% 91.79%
=======================================
Files 83 82 -1
Lines 12743 12712 -31
=======================================
- Hits 11697 11669 -28
+ Misses 1046 1043 -3
Continue to review full report at Codecov.
|
repr() function for debugging
This function replaces the older
debug.repr()and usesutil.ppretty()for nicely printing the object attributes.util.ppretty()is also extended in order to recursively call the newrepr()function. Objects are printed only once by this newrepr()avoiding infinite recursions.Finally, we use that function to print the whole ReFrame runtime state in case #1369 appears.
This function does not take into account the
__slots__for the moment. In cases, where an object does not have a__dict__attribute, the builtinrepr()will be used.An example output for a list of objects with self references is the following (see also the corresponding unit test):