[issue17660] mock.patch could whitelist builtins to not need create=True

2014-04-15 Thread Berker Peksag
Berker Peksag added the comment: +.. note:: I think using a note directive is not necessary here. Also it looks a bit ugly :) https://dl.dropboxusercontent.com/u/166024/issue17660.png +.. versionchanged:: 3.5 + If you are patching builtins in a module then you don't +

[issue17660] mock.patch could whitelist builtins to not need create=True

2014-04-15 Thread Michael Foord
Michael Foord added the comment: Personally I don't think it looks ugly and that it is a point worth calling out. Other opinions welcomed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17660

[issue17660] mock.patch could whitelist builtins to not need create=True

2014-04-15 Thread Éric Araujo
Éric Araujo added the comment: I noticed this in the commit; I don’t think the rendered output is really ugly, but the markup does look strange, as it’s two nested note(-like) directives. -- ___ Python tracker rep...@bugs.python.org

[issue17660] mock.patch could whitelist builtins to not need create=True

2014-04-14 Thread Kushal Das
Kushal Das added the comment: Updated patch with builtins module. -- versions: +Python 3.4 -Python 3.5 Added file: http://bugs.python.org/file34825/issue17660_v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17660

[issue17660] mock.patch could whitelist builtins to not need create=True

2014-04-14 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17660 ___ ___

[issue17660] mock.patch could whitelist builtins to not need create=True

2014-04-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset e457de60028c by Michael Foord in branch 'default': Closes issue 17660. You no longer need to explicitly pass create=True when patching builtin names. http://hg.python.org/cpython/rev/e457de60028c -- nosy: +python-dev resolution: - fixed

[issue17660] mock.patch could whitelist builtins to not need create=True

2014-04-11 Thread Éric Araujo
Éric Araujo added the comment: Reviewed on Rietveld. -- nosy: +eric.araujo stage: needs patch - patch review versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17660

[issue17660] mock.patch could whitelist builtins to not need create=True

2013-04-08 Thread Michael Foord
New submission from Michael Foord: When patching builtin names (e.g. open) in a specific namespace you need to specify create=True or patch will refuse to create a name that doesn't exist. patch could whitelist the builtin names, when the patch target is a module object, to not require the

[issue17660] mock.patch could whitelist builtins to not need create=True

2013-04-08 Thread Kushal Das
Kushal Das added the comment: Working on this. -- nosy: +kushaldas ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17660 ___ ___ Python-bugs-list

[issue17660] mock.patch could whitelist builtins to not need create=True

2013-04-08 Thread Kushal Das
Kushal Das added the comment: Initial patchset along with documentation and tests update. -- keywords: +patch Added file: http://bugs.python.org/file29731/issue17660.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17660

[issue17660] mock.patch could whitelist builtins to not need create=True

2013-04-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: To be honest this proposal sounds like a quirk more than a feature to me. If you only special-case builtins, people will have to remember that special case and it will make the API more complicated. -- nosy: +pitrou

[issue17660] mock.patch could whitelist builtins to not need create=True

2013-04-08 Thread Michael Foord
Michael Foord added the comment: I don't think that's a particular issue. In general you only need to use create=True if a name is *not* available in a namespace. Builtin names are odd in that you can use them in a namespace even though they don't exist there - so you have to *remember* to