[issue24134] assertRaises can behave differently

2015-06-29 Thread Robert Collins
Robert Collins added the comment: Hi, catching up (see my mail to -dev about not getting tracker mail). Deprecations++. Being nice for folk whom consume unittest2 which I backport to everything is important to me :). -- ___ Python tracker

[issue24134] assertRaises can behave differently

2015-06-03 Thread Tim Graham
Tim Graham added the comment: Unfortunately, the revert wasn't merged to the 2.7 branch until after the release of 2.7.10. I guess this regression wouldn't be considered serious enough to warrant a 2.7.11 soon, correct? -- ___ Python tracker

[issue24134] assertRaises can behave differently

2015-05-20 Thread Roundup Robot
Roundup Robot added the comment: New changeset cbe28273fd8d by Serhiy Storchaka in branch '2.7': Issue #24134: Use assertRaises() in context manager form in test_slice to https://hg.python.org/cpython/rev/cbe28273fd8d New changeset 3a1ee0b5a096 by Serhiy Storchaka in branch '3.4': Issue #24134:

[issue24134] assertRaises can behave differently

2015-05-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24134 ___

[issue24134] assertRaises can behave differently

2015-05-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Interesting, the last patch exposed a flaw in test_slice. def test_hash(self): # Verify clearing of SF bug #800796 self.assertRaises(TypeError, hash, slice(5)) self.assertRaises(TypeError, slice(5).__hash__) But the second

[issue24134] assertRaises can behave differently

2015-05-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0c93868f202e by Serhiy Storchaka in branch '2.7': Reverted issue #24134 changes. https://hg.python.org/cpython/rev/0c93868f202e New changeset a69a346f0c34 by Serhiy Storchaka in branch '3.4': Reverted issue #24134 changes (except new tests).

[issue24134] assertRaises can behave differently

2015-05-12 Thread Tim Graham
Tim Graham added the comment: I didn't find any problems while testing your proposed new patch for cpython and your proposed patch for Django together. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24134

[issue24134] assertRaises can behave differently

2015-05-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file39340/assert_raises_args_deprecation.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24134 ___

[issue24134] assertRaises can behave differently

2015-05-10 Thread R. David Murray
R. David Murray added the comment: Yeah, the general case of wrappers is something I hadn't considered. Probably we should go the deprecation route. Robert, what's your opinion? -- ___ Python tracker rep...@bugs.python.org

[issue24134] assertRaises can behave differently

2015-05-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Agree, this change breaks general wrappers around assertRaises, and this breakage is unavoidable. Likely we should rollback changes in maintained releases. The fix in Django doesn't LGTM. It depends on internal detail. More correct fix should look like:

[issue24134] assertRaises can behave differently

2015-05-10 Thread R. David Murray
R. David Murray added the comment: Given one failure there are probably more. So we should probably back this out of 2.7 and 3.4. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24134 ___

[issue24134] assertRaises can behave differently

2015-05-10 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24134 ___

[issue24134] assertRaises can behave differently

2015-05-09 Thread Tim Graham
Tim Graham added the comment: I noticed this is backwards incompatible for a small feature in Django. If you want to leave this feature in Python 2.7 and 3.4, it'll break things unless we push out a patch for Django; see https://github.com/django/django/pull/4637. -- nosy: +Tim.Graham

[issue24134] assertRaises can behave differently

2015-05-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't think this is a bug. I think it is just a case that you have to be careful when calling functions, you actually do call the function. And that it returns what you think it does. I think the critical point is this: It turned our that I forgot to

[issue24134] assertRaises can behave differently

2015-05-06 Thread Magnus Carlsson
New submission from Magnus Carlsson: Hi I have a little issue with the current assertRaises implementation. It seems that it might produce a little different results depending on how you use it. self.assertRaises(IOError, None) will not produce the same result as: with

[issue24134] assertRaises can behave differently

2015-05-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Possible solution is to use special sentinel instead of None. -- keywords: +patch nosy: +ezio.melotti, michael.foord, rbcollins, serhiy.storchaka stage: - patch review versions: +Python 3.4, Python 3.5 Added file:

[issue24134] assertRaises can behave differently

2015-05-06 Thread Magnus Carlsson
Magnus Carlsson added the comment: The solution to that is to always have a test that your decorator actually returns a function. That's what I do. Yes, I agree that with more tests I would have found the problem, but sometimes you forget things. And to me I want the tests to fail by default

[issue24134] assertRaises can behave differently

2015-05-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Updated patch includes tests for the function is None. There were no tests for assertRaises(), the patch adds them, based on tests for assertWarns(). Why not sentinel = Object()? Only for better repr in the case the sentinel is leaked. Other variants are

[issue24134] assertRaises can behave differently

2015-05-06 Thread R. David Murray
R. David Murray added the comment: Why not sentinel = Object()? +1 for the patch, once tests are added. This may break code in maintenance releases, but presumably that will be finding real bugs. It is hard to imagine someone intentionally passing None to get the context manager behavior,

[issue24134] assertRaises can behave differently

2015-05-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: The patch looks like a nice improvement. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24134 ___

[issue24134] assertRaises can behave differently

2015-05-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you David for your corrections. -- assignee: - serhiy.storchaka resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org

[issue24134] assertRaises can behave differently

2015-05-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset 111ec3d5bf19 by Serhiy Storchaka in branch '2.7': Issue #24134: assertRaises() and assertRaisesRegexp() checks are not longer https://hg.python.org/cpython/rev/111ec3d5bf19 New changeset 5418ab3e5556 by Serhiy Storchaka in branch '3.4': Issue

[issue24134] assertRaises can behave differently

2015-05-06 Thread R. David Murray
R. David Murray added the comment: Made a couple of review comments on the English in the test comments. Patch looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24134 ___