Skip to content

m prevents at_exit handlers being called #38

cliffrowley opened this Issue Jun 17, 2013 · 8 comments

5 participants


I'm using an at_exit handler in my test_helper (MiniTest), and I realise that they're not being run when I use m, but they are when I run the tests by hand. I figure that's probably down to m using exit!, which bypasses at_exit handlers.

moger777 commented Dec 4, 2013

I'm guessing this is why firefox is not closing down when running integration tests and m for me.

moger777 commented Dec 4, 2013

All tests pass when using exit as apposed to exit!, any reason why exit! was chosen?


Looks like @soffes added it for a reason in 17b586d. I can recreate the double output when not exiting, but exit and exit! both seem to work from the examples cases I've tried from the issues.

Sam, can explain issue of autoloading the suite after running a portion of it you mentioned in the commit? Would be nice to have a test around that and would make it easier to experiment with not using exit!.

zamith commented Apr 26, 2015

@cliffrowley Is this issue still happening and is it still relevant for you?

zamith commented Jul 25, 2015

I'm closing this due to inactivity.

@zamith zamith closed this Jul 25, 2015

This is still an issue and should be reopened. Among other things, this prevents Minitest.after_run from working correctly when using m.

@zamith zamith reopened this Sep 17, 2015
zamith commented Sep 17, 2015

Discussion on how to fix this on #48

@zamith zamith added a commit that referenced this issue Sep 23, 2015
@zamith zamith Run Minitest5 after_run callbacks

* M uses exit! in order to reliable finish and run and return the
correct error status to the terminal. This however means that no at_exit
handlers will ever get run. Apparently, Minitest uses this to run the
after_run blocks, as discussed in issue #38.

This change addresses the need by:

* Getting the after_run callbacks directly and running then before
returning the run output. This mimics Minitest's procedure on the
at_exit handler (as suggested by @jeremyevans). It does get a bit into
the internals of Minitest, which I'd like to avoid, but I see no other
way at the moment.
zamith commented Sep 23, 2015

It now runs Minitest's after_run callbacks, for Minitest 5. I'm not sure if it is good enough. Please provide some more feedback, if there is something missing.

@zamith zamith closed this Sep 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.