Actions
Bug #4658
closedMinitest - invalid return code when using MiniTest::Unit.after_tests
Description
If test fails and MiniTest::Unit.after_tests is used then the program returned code is 0 but it should not be.
Here is my current workaround:
MiniTest::Unit.after_tests do
status = ($! && $!.respond_to?(:status) && $!.status) || 0
do something...¶
exit(status)
end
Updated by sorah (Sorah Fukumori) almost 13 years ago
- Category set to lib
- Assignee set to zenspider (Ryan Davis)
minitest has an upstream.
Could report same issue to at the following url?
http://rubyforge.org/tracker/?atid=4097&group_id=1040&func=browse
Updated by ko1 (Koichi Sasada) almost 13 years ago
- Status changed from Open to Feedback
Updated by zenspider (Ryan Davis) almost 13 years ago
I can't replicate with ruby 1.8 or 1.9.2:
require 'rubygems'
gem 'minitest' # ensure latest gem in 1.9
require 'minitest/autorun'
class TestX < MiniTest::Unit::TestCase
def test_x
flunk
end
end
MiniTest::Unit.after_tests do
p :woot
end
exits 1
Updated by zenspider (Ryan Davis) almost 13 years ago
Just in case a repro comes up, the above code doesn't cover all cases correctly. I'm currently going with:
status = $!.respond_to?(:status) ? $!.status : ($! ? 1 : 0)
Updated by zenspider (Ryan Davis) almost 13 years ago
- Status changed from Feedback to Rejected
No reply. Closing.
Actions
Like0
Like0Like0Like0Like0Like0