Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Minor tweak to make meck work with rebar/cover_enabled=true #17

Closed
wants to merge 1 commit into from

Conversation

jonmeredith
Copy link

Hi,

Thanks for writing meck, it's just what I need for mocking up modules for testing.

I hit an issue using meck with rebar in eunit tests if {cover_enabled, true} was set in rebar.config. When rebar runs tests, it recompiles all the source code into a directory called .eunit rather than ebin and calls cover:compile_beam/1 for them. After that cover:is_compiled returns a .beam file instead of a .erl file, so when restore_original tries it put the module back calling cover:compile on a .beam file blows up.

The patch just adds a simple check on the file extension and compiles appropriately.

Cheers, Jon Meredith

…rather than .erl and restore them appropriately.
@jonmeredith
Copy link
Author

Always the way, as soon as you submit a pull request you find an issue. I'm getting lots of
WARNING: Deleting data for module imported from

This needs a bit more attention before it is pull-worthy.

@eproxus
Copy link
Owner

eproxus commented Sep 2, 2010

Thanks a lot for the patch! Awesome work.

The warnings you see are unfortunately hard coded in the cover application. :-(
I myself have a patched version which suppresses all output from cover, this should probably go into OTP...

@mmcc
Copy link

mmcc commented May 16, 2018

@eproxus any chance this patched version is available somewhere? The warning output is driving us crazy :)

@eproxus eproxus reopened this May 17, 2018
@eproxus
Copy link
Owner

eproxus commented May 17, 2018

@mmcc I'll take a look!

@eproxus eproxus closed this May 17, 2018
@eproxus
Copy link
Owner

eproxus commented May 17, 2018

@mmcc I assume you refer to these warning: https://github.com/erlang/otp/blob/master/lib/tools/src/cover.erl#L1326-L1365

It should be a simple matter of replacing them with a no-op such as ok.

@themitigater
Copy link

Hey @eproxus, thoughts on making this available?

@eproxus
Copy link
Owner

eproxus commented Aug 26, 2020

@themitigater Unfortunately I don't have a patch for any modern versions of OTP. If you happen to make the modifications yourself, I'd be more than happy to link to a patch in the documentation!

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants