[New-bugs-announce] [issue24694] callables registered in TestCase.addCleanup should be run before tearDown
Charles-François Natali
report at bugs.python.org
Thu Jul 23 15:43:04 CEST 2015
New submission from Charles-François Natali:
Consider this code:
-----------------------------------------------------
from __future__ import print_function
from pyccp.unittest import SafeTestCase
class MyTest(SafeTestCase):
def setUp(self):
print("setUp")
def tearDown(self):
print("tearDown")
def test(self):
print("creating")
self.addCleanup(lambda: print("destroying"))
-----------------------------------------------------
When run:
setUp
creating
tearDown
destroying
We lose the LIFO ordering between between setUP and addCleanup, which is highly counter-intuitive, and almost always incorrect (despite addCleanup being docuemented to be run after tearDown).
----------
components: Library (Lib)
messages: 247196
nosy: neologix
priority: normal
severity: normal
status: open
title: callables registered in TestCase.addCleanup should be run before tearDown
type: behavior
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24694>
_______________________________________
More information about the New-bugs-announce
mailing list