-
Notifications
You must be signed in to change notification settings - Fork 246
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
Add support for reseting the Eunit environment after each test #385
base: develop
Are you sure you want to change the base?
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
perform_eunit(Config, Tests, StatusBefore, DoClean); | ||
_IsTrue -> | ||
?DEBUG("running cleanup after each test", []), | ||
[perform_eunit(Config, T, StatusBefore, true) || T <- Tests] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_opts
option 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