Skip to content
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

Consider improvements to the teardown syntax. #23

Open
obmarg opened this issue Jan 19, 2016 · 0 comments
Open

Consider improvements to the teardown syntax. #23

obmarg opened this issue Jan 19, 2016 · 0 comments

Comments

@obmarg
Copy link
Owner

obmarg commented Jan 19, 2016

If a fixture needs to do some teardown, at the moment it ends up looking a bit like this:

deffixture db do
   db = setup_db
   teardown fn ->
     close_db(db)
   end
   db
end

It might be nice to provide a better mechanism for teardown code. py.test has it's yield fixtures which are pretty nice, but (failing anything nicer) we could maybe provide a macro named yield/return/something that provides a bit of sugar around the above:

deffixture db do
   db = setup_db
   yield db, teardown: fn ->
     close_db(db)
   end
end
@obmarg obmarg changed the title Consider improvements to the on_exit syntax. Consider improvements to the teardown syntax. Mar 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant