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

39 views
Skip to first unread message

Shahbaj Sayyad

unread,
Feb 12, 2018, 8:22:30 AM2/12/18
to Django developers (Contributions to Django itself)
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
Reply all
Reply to author
Forward
0 new messages