[issue24694] callables registered in TestCase.addCleanup should be run before tearDown

2015-07-23 Thread Charles-François Natali
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):

[issue24694] callables registered in TestCase.addCleanup should be run before tearDown

2015-07-23 Thread Yury Selivanov
Yury Selivanov added the comment: This is a documented behaviour, changing it would likely break too much code. Moreover, I don't think that calling addCleanup callbacks before tearDown makes more sense than after. tearDown is a common cleanup method for all tests of testcase, and addCleanup

[issue24694] callables registered in TestCase.addCleanup should be run before tearDown

2015-07-23 Thread Robert Collins
Robert Collins added the comment: The ordering is deliberate to support folk migrating from tearDown to cleanups - its not a bug. I thought we documented it clearly - https://docs.python.org/dev/library/unittest.html#unittest.TestCase.doCleanups - but if you wanted to submit improvements to

[issue24694] callables registered in TestCase.addCleanup should be run before tearDown

2015-07-23 Thread Charles-François Natali
Charles-François Natali added the comment: I understand the risk of breakeage, but that's still broken, because we break LIFO ordering. I'd been using addCleanup() for years and never bothered looking at the documentation - which is admitedly a mistake - because LIFO ordering is the natural

[issue24694] callables registered in TestCase.addCleanup should be run before tearDown

2015-07-23 Thread Robert Collins
Robert Collins added the comment: So yeah - setup + cleanup is LIFO. setup + teardown *can* be LIFO [depends on where you upcall] setup + teardown + cleanup CANNOT be LIFO in all cases: we have to pick one, and either local-first or local-last. So it is ultimately somewhat arbitrary and

[issue24694] callables registered in TestCase.addCleanup should be run before tearDown

2015-07-23 Thread Yury Selivanov
Yury Selivanov added the comment: But I guess that ship has sailed... Closing the issue. -- resolution: - not a bug stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24694

[issue24694] callables registered in TestCase.addCleanup should be run before tearDown

2015-07-23 Thread Robert Collins
Robert Collins added the comment: Argh, and my memory had things inverted. Anyhow - the inheritance story was the big thing, and -1 on changing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24694