summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVít Ondruch <vondruch@redhat.com>2023-11-09 15:59:18 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-11-13 11:06:10 +0900
commit43b8b8875115f1883d7654a663a9238343cb90ab (patch)
tree174d2f2e1e738287ca63a6373637faa4505f0372 /test
parent9a62fd3cbae2ebb60e2f9cad782af1ad18db4319 (diff)
[rubygems/rubygems] Report possible error prior checking output of gem uninstall
Originally, the failed test case reported following error: ~~~ Failure: test_gem_exec_gem_uninstall(TestGemCommandsExecCommand): <""> was expected to include <"Successfully uninstalled a-2\n">. /mnt/test/rubygems/test_gem_commands_exec_command.rb:742:in `block in test_gem_exec_gem_uninstall' 739: 740: # assert_empty @ui.error 741: refute_includes @ui.output, "running gem exec with" => 742: assert_includes @ui.output, "Successfully uninstalled a-2\n" 743: 744: invoke "--verbose", "gem", "uninstall", "b" 745: assert_includes @ui.output, "Successfully uninstalled b-2\n" /mnt/lib/rubygems/user_interaction.rb:46:in `use_ui' /mnt/lib/rubygems/user_interaction.rb:69:in `use_ui' /mnt/test/rubygems/test_gem_commands_exec_command.rb:726:in `test_gem_exec_gem_uninstall' ~~~ This does not tell much. Empty string is more often good sign, but not in this case. However, checking error output first helps with understanding possible issue: ~~~ Failure: test_gem_exec_gem_uninstall(TestGemCommandsExecCommand): <"ERROR: While executing gem ... (Gem::FilePermissionError)\n" + " You don't have write permissions for the /builddir/bin directory.\n" + "\t/mnt/lib/rubygems/uninstaller.rb:213:in `remove_executables'\n" + ... snip ... /mnt/test/rubygems/test_gem_commands_exec_command.rb:740:in `block in test_gem_exec_gem_uninstall' 737: nil 738: end 739: => 740: assert_empty @ui.error 741: refute_includes @ui.output, "running gem exec with" 742: assert_includes @ui.output, "Successfully uninstalled a-2\n" 743: /mnt/lib/rubygems/user_interaction.rb:46:in `use_ui' /mnt/lib/rubygems/user_interaction.rb:69:in `use_ui' /mnt/test/rubygems/test_gem_commands_exec_command.rb:726:in `test_gem_exec_gem_uninstall' ~~~ BTW this issue is caused by operating_system.rb overriding `Gem.operating_system_defaults` method and explicitly adding `--bindir` option. https://github.com/rubygems/rubygems/commit/d98e36bbe7
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_commands_exec_command.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_exec_command.rb b/test/rubygems/test_gem_commands_exec_command.rb
index e8bd354bc3..28da23cc3b 100644
--- a/test/rubygems/test_gem_commands_exec_command.rb
+++ b/test/rubygems/test_gem_commands_exec_command.rb
@@ -736,6 +736,8 @@ class TestGemCommandsExecCommand < Gem::TestCase
rescue StandardError
nil
end
+
+ assert_empty @ui.error
refute_includes @ui.output, "running gem exec with"
assert_includes @ui.output, "Successfully uninstalled a-2\n"