Help required with bug #29024 (`TestContextDecorator` never exits if `setUp` fails in tests)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help required with bug #29024 (`TestContextDecorator` never exits if `setUp` fails in tests)

Shahbaj Sayyad
Hey guys i'm trying to solve bug https://code.djangoproject.com/ticket/29024 , the suggestion provided is that i use addCleanup inside setUp or use setUpClass and tearDownClass.
I tried using addCleanup inside setUp function of TestContextDecorator but as the class TestContextDecorator isn't a subclass of TestCase i'm not able to use addCleanup.
Though using addCleanup  inside of

setUp function of Example2TestCase given in the example code solves the bug, but i don't that is the correct way to solve this bug.
What should i do here?
So far i have used try and except inside the setUp of TestContextDecorator and that seems to solve the bug but i'm not sure if its the best way to do it. Here are the changes i made http://dpaste.com/1MYKGR3

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/c5256710-8d5f-4f99-8f3d-3f09a103d8e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.