summaryrefslogtreecommitdiff
path: root/src/rebar_prv_eunit.erl
diff options
context:
space:
mode:
authoralisdair sullivan <alisdairsullivan@yahoo.ca>2015-01-07 17:59:07 -0800
committeralisdair sullivan <alisdairsullivan@yahoo.ca>2015-01-07 17:59:07 -0800
commite5270da3d751605fbb6fbcdfd12ad0d76e1fcfbd (patch)
treedb5d56c6e83872f06b94b2e35343f21598ba605b /src/rebar_prv_eunit.erl
parentb205bebecc5e96c8b07b8c727356b0efb7e31562 (diff)
preserve rebar path when running `ct` and `eunit` tests
Diffstat (limited to 'src/rebar_prv_eunit.erl')
-rw-r--r--src/rebar_prv_eunit.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl
index cb0e850..7db11a3 100644
--- a/src/rebar_prv_eunit.erl
+++ b/src/rebar_prv_eunit.erl
@@ -41,7 +41,7 @@ do(State) ->
OutDir = case proplists:get_value(outdir, Opts, undefined) of
undefined -> filename:join([rebar_state:dir(State),
ec_file:insecure_mkdtemp()]);
- Path -> Path
+ Out -> Out
end,
?DEBUG("Compiling EUnit instrumented modules in: ~p", [OutDir]),
lists:foreach(fun(App) ->
@@ -54,11 +54,14 @@ do(State) ->
TestState = first_files(test_opts(S, OutDir)),
ok = rebar_erlc_compiler:compile(TestState, AppDir)
end, ProjectApps),
+ Path = code:get_path(),
true = code:add_patha(OutDir),
EUnitOpts = resolve_eunit_opts(State, Opts),
AppsToTest = [{application, erlang:binary_to_atom(rebar_app_info:name(App), unicode)}
|| App <- ProjectApps],
- case handle_results(eunit:test(AppsToTest, EUnitOpts)) of
+ Result = eunit:test(AppsToTest, EUnitOpts),
+ true = code:set_path(Path),
+ case handle_results(Result) of
{error, Reason} ->
{error, {?MODULE, Reason}};
ok ->