Project

General

Profile

Actions

Bug #4658

closed

Minitest - invalid return code when using MiniTest::Unit.after_tests

Added by rupert (Robert Pankowecki) about 11 years ago. Updated almost 11 years ago.

Status:
Rejected
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.2p136 (2010-12-25 revision 30365) [i686-linux]
Backport:
[ruby-core:36053]

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) about 11 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) about 11 years ago

  • Status changed from Open to Feedback

Updated by zenspider (Ryan Davis) about 11 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) about 11 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 11 years ago

  • Status changed from Feedback to Rejected

No reply. Closing.

Actions

Also available in: Atom PDF