eproxus / meck

A mocking library for Erlang
http://eproxus.github.io/meck
Apache License 2.0
813 stars 231 forks source link

meck tests always fail? #140

Closed okeuday closed 9 years ago

okeuday commented 9 years ago

I am filing this separate from #134 though it is likely related. I have been unable to find a commit to meck that has eunit tests which all pass successfully (when using R16B03-1). The include_lib usage of hamcrest makes hamcrest a requirement for using the meck eunit tests, though the hamcrest dependency is not provided in the rebar.config file. The meck rebar.config file has the compile options warn_export_all and warn_unused_import, along with warnings_as_errors, which makes any usage of the hamcrest include file cause the meck eunit tests to fail. If there were Travis testing setup it would be easier to see if the eunit tests succeed with any versions of Erlang. If hamcrest was a dependency in the meck rebar.config file, you would be able to prove that a version combination actually works, due to normal usage with eunit tests. Are you aware of a working version of meck?

eproxus commented 9 years ago

Meck uses a different Rebar config file for tests, since there is no way to specify optional dependencies in Rebar. If you want to run the tests, make test should suffice. If you want to run them manually, you can take a look at the Makefile (https://github.com/eproxus/meck/blob/master/Makefile#L39). Essentially you need to run the following commands (this is what make test does):

rebar -C test.config get-deps
rebar skip_deps=true compile # To build Meck with warnings as errors
rebar -C test.config compile # To build Hamcrest
rebar -C test.config skip_deps=true eunit

Travis has been set up for Meck since a long time ago and you can see the results here: https://travis-ci.org/eproxus/meck

okeuday commented 9 years ago

Very cool. I was trying to assume that the eunit tests could always pass with the same configuration, and I agree that is a problematic assumption with rebar. Thank you for the info.

eproxus commented 9 years ago

It may be possible to have the Hamcrest tests separated somehowe (e.g. test and test_hamcrest folders). If you could figure out something that works better, I'm happy to take a look at it. I agree that it is a bit problematic at the moment that rebar eunit doesn't work out of the box, and make test have to be used.