-
-
Notifications
You must be signed in to change notification settings - Fork 765
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
Call super in Formatter.close methods to ensure sync is reset #3094
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks for spotting this, theres an unnecessary change to be reverted in the base formatter, and ideally some sort of test to be added to show the problem this causes if any
@JonRowe @pirj I was finally able to set up a 2.7 environment that did successfully reproduce the CI failures on 2.7, so I can dig into this. I have a question about preferred implementation. The test failures are because in three situations it's possible to call
I'm leaning towards the first option since it will protect against future uses of formatters outside of the Reporter notification system in addition to fixing the current problem. Let me know if you disagree |
This test fails without adding the call to super in BaseTextFormatter#close
expect { | ||
formatter.close(RSpec::Core::Notifications::NullNotification) | ||
}.to change(output_to_close, :sync).from(true).to(false) | ||
end |
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.
I'm glad this passes as is, but is it in the right place? This is actually implemented in the base formatter, and if this is testing the super
call then it doesn't cover the base formatter and the json formatter, prehaps some of these should be a shared example we call across all the formatters that need it?
There were two instances (that I could find) of overridden methods in classes inheriting from
BaseFormatter
that likely should have calledsuper
to complete the cleanup.