@@ -44,27 +44,12 @@ defmodule ExUnit.Runner do
4444 config = configure ( opts , manager , self ( ) , stats_pid )
4545 :erlang . system_flag ( :backtrace_depth , Keyword . fetch! ( opts , :stacktrace_depth ) )
4646
47- modules_to_restore =
48- if Keyword . fetch! ( opts , :repeat_until_failure ) > 0 , do: { [ ] , [ ] } , else: nil
49-
50- modules_to_restore =
51- if not opts [ :dry_run ] do
52- do_run ( config , modules_to_restore , opts , load_us )
53- else
54- nil
55- end
56-
57- stats = ExUnit.RunnerStats . stats ( stats_pid )
58- EM . stop ( config . manager )
59- after_suite_callbacks = Application . fetch_env! ( :ex_unit , :after_suite )
60- Enum . each ( after_suite_callbacks , fn callback -> callback . ( stats ) end )
61- { stats , modules_to_restore }
62- end
63-
64- defp do_run ( config , modules_to_restore , opts , load_us ) do
6547 start_time = System . monotonic_time ( )
6648 EM . suite_started ( config . manager , opts )
6749
50+ modules_to_restore =
51+ if Keyword . fetch! ( opts , :repeat_until_failure ) > 0 , do: { [ ] , [ ] } , else: nil
52+
6853 { async_stop_time , modules_to_restore } = async_loop ( config , % { } , false , modules_to_restore )
6954 stop_time = System . monotonic_time ( )
7055
@@ -80,7 +65,11 @@ defmodule ExUnit.Runner do
8065 times_us = % { async: async_us , load: load_us , run: run_us }
8166 EM . suite_finished ( config . manager , times_us )
8267
83- modules_to_restore
68+ stats = ExUnit.RunnerStats . stats ( stats_pid )
69+ EM . stop ( config . manager )
70+ after_suite_callbacks = Application . fetch_env! ( :ex_unit , :after_suite )
71+ Enum . each ( after_suite_callbacks , fn callback -> callback . ( stats ) end )
72+ { stats , modules_to_restore }
8473 end
8574
8675 defp configure ( opts , manager , runner_pid , stats_pid ) do
@@ -318,6 +307,10 @@ defmodule ExUnit.Runner do
318307 { test_module , [ ] , [ ] }
319308 end
320309
310+ defp run_module_tests ( % { dry_run: true } , test_module , _async? , tests ) do
311+ { test_module , [ ] , tests }
312+ end
313+
321314 defp run_module_tests ( config , test_module , async? , tests ) do
322315 Process . put ( @ current_key , test_module )
323316 % ExUnit.TestModule { name: module , tags: tags , parameters: params } = test_module
0 commit comments