seattlerb/minitest — pull request #178 by tenderlove (2012-10-22 17:54:59+00:00)
Title: Add support for changing execution strategy

I've made the minimal changes necessary to `MiniTest::Unit` in order to support changing execution strategy, e.g. running every test method in it's own thread.

I changed setting `start_time` to use a local variable and an instance variable. Setting the instance variable isn't thread-safe, but it's required for the trap. The trap isn't thread safe, so I don't think we should worry about the time being incorrect in the trap. This patch uses the local variable for final time calculation to ensure the final report is accurate.

I added a method `_map_run` that just takes the list of test methods, maps over them and yields to a block. The parallel runner in the tests implements this method and runs the tests in parallel. The tests I added will fail with a deadlock if they aren't run in parallel.