davetron5000 / gli

Make awesome command-line applications the easy way
http://davetron5000.github.io/gli
Apache License 2.0
1.26k stars 102 forks source link

Use minitest compatibility mode so we can use Minitest 5 #324

Closed rsanheim closed 1 month ago

rsanheim commented 1 month ago

Minitest long ago renamed its main constants to Minitest. To be able to stay up to date w/ the latest Minitest gem, we can invoke MT_COMPAT via env var and get a (mostly) passing build with the Minitest 5 gem.

This is probably preferable to trying to find the correct combination of old minitest gems that work, especially given minutest also became part of the ruby stdlib in version 2. Using the latest gem should help us sidestep any sort of rubygem vs ruby stdlib type issues.

The longer term fix here is to update all constants to be Minitest, but I don't care to shave that yak today 😁 .

With the MT_COMPAT fix here I get passing integration tests and all but on unit tests pass. Without it everything breaks before the first test runs.

Fixes https://github.com/davetron5000/gli/issues/323

See some discussion in https://github.com/freerange/mocha/issues/614 and https://github.com/minitest/minitest/issues/960 ...

rsanheim commented 1 month ago

Here is the one failing spec, its repeatable so assuming it is an setup issue or perhaps something with the ruby version.

Finished in 0.276384s, 560.8139 runs/s, 2760.6518 assertions/s.

  1) Failure:
CommandTest#test_pre_exiting_false_causes_nonzero_exit [test/unit/command_test.rb:404]:
--- expected
+++ actual
@@ -1 +1,25 @@
-"error: preconditions failed"
+# encoding: ASCII-8BIT
+#    valid: true
+"/Users/rsanheim/src/oss/gli/lib/gli/dsl.rb:176: warning: instance variable @next_arguments not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/dsl.rb:181: warning: instance variable @hide_commands_without_desc not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/app_support.rb:168: warning: instance variable @help_sort_type not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/app_support.rb:172: warning: instance variable @help_text_wrap_type not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/app_support.rb:176: warning: instance variable @synopsis_format_type not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/dsl.rb:181: warning: instance variable @hide_commands_without_desc not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/dsl.rb:181: warning: instance variable @hide_commands_without_desc not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/dsl.rb:176: warning: instance variable @next_arguments not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/app_support.rb:62: warning: instance variable @preserve_argv not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/command_support.rb:149: warning: instance variable @default_command not initialized
+
+/Users/rsanheim/src/oss/gli/lib/gli/command_support.rb:149: warning: instance variable @default_command not initialized
+
+error: preconditions failed"

155 runs, 763 assertions, 1 failures, 0 errors, 0 skips
rake aborted!
davetron5000 commented 1 month ago

Thanks for discovering! I've done a different fix for this in https://github.com/davetron5000/gli/pull/325 basically because the build matrix was out of date and it wasn't clear which Rubies this project supports. Ruby 2.7 was EOL'd last year so I don't want to spend a lot of energy supporting it (though I think my change would be compatible)