Skip to content

refactor: move dependency requires to ruby_runner.rb file #609

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

Merged
merged 2 commits into from
May 30, 2025

Conversation

pvdb
Copy link
Contributor

@pvdb pvdb commented Dec 20, 2024

There are three test cases that include the RubyRunner module:

$ git grep -l 'include RubyRunner'
test/test_rake_backtrace.rb
test/test_rake_functional.rb
test/test_rake_reduce_compat.rb
$ _

... which previously required the indirect open3 and fileutils dependencies themselves, so this PR moves the requires to ruby_runner.rb where they belong.

In addition, and in a separate commit to make reviewing easier, this PR also removes some superfluous stringio require statements in two other files that don't actually use StringIO in any of their tests ... this was tested extensively by running each test in isolation (as opposed to "in bulk" using rake test) as follows:

$ git ls-files 'test/test_*.rb'|xargs -n1 ruby
...
$ _

Thanks, @hsbt ! 🙏


PS - a nice side-effect of this refactor is that the ruby_runner.rb file is now "correct" Ruby code, which it currently - on master - isn't:

$ ruby test/support/ruby_runner.rb 
test/support/ruby_runner.rb:3:in `<module:RubyRunner>': uninitialized constant RubyRunner::FileUtils (NameError)

  include FileUtils
          ^^^^^^^^^
Did you mean?  FileTest
	from test/support/ruby_runner.rb:2:in `<main>'

$ _

@pvdb pvdb force-pushed the fix_rubyrunner_require branch from 8773e57 to a205f83 Compare December 20, 2024 08:30
@hsbt hsbt force-pushed the fix_rubyrunner_require branch from f1b164e to 0b727e9 Compare May 30, 2025 05:43
@hsbt hsbt merged commit 8e917d9 into ruby:master May 30, 2025
30 checks passed
@hsbt
Copy link
Member

hsbt commented May 30, 2025

Sorry my late action. Thanks!

@pvdb pvdb deleted the fix_rubyrunner_require branch May 31, 2025 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants