Add support for reseting the Eunit environment after each test#385
Add support for reseting the Eunit environment after each test#385
Conversation
fixed type and case statement ordering removed unecessary ?DEBUG statement
|
Tests pass and code is readable. I'd like to see a test for this specific feature, though. |
|
Further testing shows this may not work as expected. rebar eunit skip_deps=true reset_after_eunit=true
ERROR: eunit failed while processing /Users/micahw/src/riak_repl: {'EXIT',{{case_clause,"true"},
[{rebar_eunit,maybe_cleanup,2,
[{file,"src/rebar_eunit.erl"},{line,207}]},
{rebar_eunit,perform_eunit,4,
[{file,"src/rebar_eunit.erl"},{line,426}]},
{rebar_eunit,run_eunit,3,[{file,"src/rebar_eunit.erl"},{line,182}]},
{rebar_core,run_modules,4,[{file,"src/rebar_core.erl"},{line,446}]},
{rebar_core,execute,5,[{file,"src/rebar_core.erl"},{line,371}]},
{rebar_core,process_dir1,6,[{file,"src/rebar_core.erl"},{line,235}]},
{rebar_core,process_commands,2,
[{file,"src/rebar_core.erl"},{line,90}]},
{rebar,main,1,[{file,"src/rebar.erl"},{line,58}]}]}}A similar crash happens if reset_after_eunit is set to false. Also, trying to set the reset_after_each_eunit to false doesn't actually work as demonstrated by the debug output: Finally, note the lack of a newline before the second DEBUG. |
…booleans as strings; changed it to convert
src/rebar_eunit.erl
Outdated
There was a problem hiding this comment.
Please put a newline in the above debug. the debug macro isn't nice enough to do one for you.
|
@lordnull ping, did the new commits fix your issues? |
|
Re-ping? |
|
@slfritchie @lordnull I honestly just need a +1 and I'll put this through. |
|
I'm not an active reviewer (yet), I was dragged in by Jon. :-) I'm still catching up on a huge backlog of correspondence & to-do items from my vacation, so it's likely a couple of days before I can sneak in a review of this ticket. Micah? |
|
This needs a little more work to be ready -- issues were uncovered by Sorry for the delay. On Wed, Nov 20, 2013 at 10:32 PM, Scott Lystig Fritchie <
|
Fix Dialyzer warning introduced in 0caf047
Overview
Add a command-line parameter, reset_after_each_eunit=[true|false], that if true runs each eunit suite individually and employs @slfritchie logic to reset the enviroment after each one.
This was done because tests within replication were found to be polluting the environment of subsequent tests.
Configuration
Added new property to
eunit_optsoption list:reset_after_each_eunit::boolean() - default = false.
If true, try to "reset" VM state to approximate state prior to
running each EUnit test:
* Stop net_kernel if it was started
* Stop OTP applications not running before EUnit tests were run
* Kill processes not running before EUnit tests were run
* Reset OTP application environment variables
Related PR
#107