-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When cover is enabled in rebar.config after test meck failed with enoent #111
Comments
Could you attach a (preferably) minimal test module so I can reproduce this? |
I managed to reproduce but the bug is just partly related to the cover thing, it came up with lager_transform only. rebar.config {erl_opts, [debug_info,
{parse_transform, lager_transform}]}.
{cover_enabled, true}.
{deps, [
{lager, ".*",
{git, "git://github.com/basho/lager.git", {tag, "2.0.0"}}},
{meck, ".*",
{git, "git://github.com/eproxus/meck.git", {tag, "0.7.2"}}}
]}. src/meckbug.app.src: just a placeholder in order that rebar starts work {application, meckbug,
[
{description, ""},
{vsn, "1"},
{registered, []},
{applications, [
kernel,
stdlib
]},
{mod, { meckbug_app, []}},
{env, []}
]}. src/my_module.erl: -module(my_module).
-export([calculate/2]).
calculate(A, B) ->
lager:info("Addig ~p and ~p", [A, B]), %% without this, everything is fine
A + B. src/my_other.erl: -module(my_other).
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.
-ifdef(TEST).
calculate_test() ->
meck:new(my_module, [passthrough]),
meck:expect(my_module, calculate,
fun(1, 2) ->
5
end),
?debugVal(my_module:calculate(1, 2)),
?assertEqual(5, my_module:calculate(1, 2)),
meck:unload(my_module),
meck:new(my_module).
-endif. ./rebar compile So the problem is to meck:new() a module which is lager transformed. |
I'm seeing the same problem. Was there any resolution? |
*Ignore this, this is a separate issue #114 * Further investigation seems to show If I hack on |
@jonasrichard You call |
Yes, it seems that removing extra meck:unload(my_module),
my_module:calculate(1, 2).
%%meck:new(my_module). After changing the eunit test I didn't get any error, and I am able to use |
The test using:
The reason behind the unload/new again is to leave the module loaded. Otherwise consecutive tests will fail in error:undef my_module:time/1.
Am I doing something wrong or meck is confused?
The text was updated successfully, but these errors were encountered: