-
-
Notifications
You must be signed in to change notification settings - Fork 759
Use configuration rather than streams directly in deprecation formatter and fall back to std pipes #1128
Conversation
@@ -105,6 +105,9 @@ def self.add_setting(name, opts={}) | |||
# @macro add_setting | |||
# Default: `$stderr`. | |||
add_setting :deprecation_stream | |||
def deprecation_stream=(filename_or_io) | |||
@deprecation_stream = file_or_io_from(filename_or_io) | |||
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.
Note, we either need to do this consistently across the two streams, or rework this into the formatter (due to how we used to pass in the pipes) or make the pipes themselves smarter... (e.g. if we give them a class that takes a default value, but allow them to be reconfigurable by mutation rather than replacement, we could also then ask the pipe if configured in the commandline runner)
Thanks for taking a stab at this, @JonRowe. This solves the immediate problem, but it feels like it's working around what is a deeper design issue that we should solve more systemically. Specifically:
All that said -- some of my ideas above would be breaking changes that are only appropriate for master/3.0, and what you have here might be the right solution for 2.99. Thoughts? |
Your commit message made me chuckle :). What are your thoughts on the stuff I put above? I'm thinking this is a good solution for 2.99 but for 3.0 we may go a different direction. |
It should, we talked about addressing it before but the
So you can configure them at runtime programatically and extend if your a 3rd party. I'd like to see runner configuring the streams at runtime (they would then be overridable in spec_helper etc via configuration).
If we defer to configuration there's no need to lock to any specific value, just the current configuration. I'm mostly thinking about tools which rerun specs or otherwise modify things to which this would advantage. If we don't depend on them being locked it's easier to write such tools.
I'd start with merging a version of this, back porting to 2.99 and then refactoring to suit. |
IMO, the expected/desired behavior is to make I still think that allowing
"So you can configure" -- that's why we provide
The problem I'm seeing (both with the current code and with the changes in this PR) is that once the
Do you mind backporting this to 2.99 first since I'm still not convinced this is the solution we want for 3.0? |
This was solved by #1142 instead. |
Potential solution to #1127