Skip to content

meck:unload is undefined? #72

ostinelli opened this Issue Jul 23, 2012 · 3 comments

2 participants


Using this module, and R15B01:


get_config() ->


get_config_test_() ->
    meck:expect(mocked, myfun, fun(Filename) -> ok end),
    ?_assertEqual(ok, get_config()),

Compiling and running tests:

1> c(example, [{d, 'TEST'}]).
example.erl:19: Warning: variable 'Filename' is unused
example.erl:20: Warning: a term is constructed, but never used
example.erl:21: Warning: a term is constructed, but never used
12> example:test().           
*** test module not found ***

  Failed: 0.  Skipped: 0.  Passed: 0.
One or more tests were cancelled.

However, if I comment the line meck:unload(mocked). then test passes successfully.

eproxus commented Aug 3, 2012

Sorry for the late reply. The issue occurs because the trailing underscore (get_config_test_) tells EUnit that the function is a test generator, not a test. EUnit then expects the function to return a list of tests instead.

@eproxus eproxus closed this Aug 3, 2012

indeed, it's a generator. i guess then meck has to be used within a test. i haven't find anything clarifying that in docs.

thank you,


eproxus commented Aug 11, 2012

Meck is not tied to a specific test library or framework. It just has a functional API that you can use in any code, really.

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.