Print original bundle variable names in stateful mode#3902
Conversation
8e90c32 to
80ee339
Compare
Zac-HD
left a comment
There was a problem hiding this comment.
Thank you so much @fm4v! I wish we'd thought of this years ago, and I'm really looking forward to both using it myself and shipping it to our users 😁
I've left one comment below about the linting/lambda thing; this otherwise looks fantastic and I expect to get it out very soon.
| for target in targets: | ||
| name = self._new_name(target) | ||
| self.__printer.singleton_pprinters.setdefault( | ||
| id(result), lambda obj, p, cycle: p.text(name) | ||
| ) |
There was a problem hiding this comment.
The lint rule is pointing out that every single lambda you're defining here will print the name defined in the last loop iteration. I implemented that because it tends to catch real bugs!
As a result, I'm also nervous because the tests are passing, and so we must not have anthing that checks for correct printing of bundle names from a rule which returns multiple targets. Can you add a test for this? The lambda is easy to fix with a binding lambda obj, p, cycle, *, name=name: p.text(name).
There was a problem hiding this comment.
Sure, there was a problem with printing results for several targets using multiple(), but it has now been fixed and covered with tests.
261edd0 to
e2a9665
Compare
e2a9665 to
cd51b85
Compare
I often use the output of stateful testing to see what tests are generated, and poor naming hinders understanding of the code. This PR changes the names of variables and rule arguments depending on the name of the bundle.
Here is example of how it look now, instead of
v1,v2,v3,..naming