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

Preserve order of nested asynchronous teardowns #223

Closed
evanp opened this issue Jul 27, 2012 · 4 comments
Closed

Preserve order of nested asynchronous teardowns #223

evanp opened this issue Jul 27, 2012 · 4 comments

Comments

@evanp
Copy link
Contributor

evanp commented Jul 27, 2012

The teardown for a context should only fire after the teardown of its contained contexts have finished.

I use teardowns for testing persistence code. The outer context makes the database connection and its teardown disconnects; inner contexts create temporary database structures and their teardowns delete the structures.

(And, yes, I'm aware that it's possible to just leave those structures in place, or what have you. But I think that good unit tests clean up after themselves.)

We've got good support for letting sub-contexts finish most of their work before teardowns happen; let's finish the job.

@evanp
Copy link
Contributor Author

evanp commented Jul 27, 2012

Here's example code that shows the problem:

https://gist.github.com/3188646

@indexzero
Copy link

I think this is a duplicate of #179, but I like your example better. Will leave this open and close #179.

@indexzero
Copy link

@evanp thought about this a bit more as I fixed it and it is most definitely a breaking change. Fix was committed in 1242b19, and we are just about to release v0.9.x so this should be coming soon.

@evanp
Copy link
Contributor Author

evanp commented Apr 27, 2018

This works in 1.x, so I'm closing it.

@evanp evanp closed this as completed Apr 27, 2018
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

2 participants