[issue32933] mock_open does not support iteration around text files.

2018-09-14 Thread Berker Peksag
Berker Peksag added the comment: New changeset c83c375ed907bdd54361aa36ce76130360f323a4 by Berker Peksag (Miss Islington (bot)) in branch '3.7': bpo-32933: Implement __iter__ method on mock_open() (GH-5974) https://github.com/python/cpython/commit/c83c375ed907bdd54361aa36ce76130360f323a4

[issue32933] mock_open does not support iteration around text files.

2018-09-14 Thread Anthony Flury
Anthony Flury added the comment: Thank you. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32933] mock_open does not support iteration around text files.

2018-09-14 Thread Berker Peksag
Berker Peksag added the comment: Thanks, Ned! Anthony, I'm one of the maintainers of https://github.com/testing-cabal/mock and I'd be happy to merge a PR that backports the fix to the PyPI version of mock. -- versions: +Python 3.7 ___ Python

[issue32933] mock_open does not support iteration around text files.

2018-09-14 Thread miss-islington
Change by miss-islington : -- pull_requests: +8737 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32933] mock_open does not support iteration around text files.

2018-09-14 Thread Ned Deily
Ned Deily added the comment: The potential change in behavior affecting existing code was one issue. But the other was the fact that people writing tests to make use of the new behavior can't depend on that behavior being there for 3.7 or 3.6 without checking the patch level, for example,

[issue32933] mock_open does not support iteration around text files.

2018-09-14 Thread Anthony Flury
Anthony Flury added the comment: I still support backporting to 3.6 and 3.7 : Yes it is correct that this fix could change the behavior of existing test code, but only if someone has written a test case for a function where : 1. The function under test uses dunder_iter iteration 2. The

[issue32933] mock_open does not support iteration around text files.

2018-09-13 Thread Ned Deily
Ned Deily added the comment: While I think arguments could be made either way, this seems to me to be somewhat more of a bugfix (rather than a feature) in the sense that mock_open did not correctly emulate a real textfile open at least for an idiom that is commonly used (while acknowledging

[issue32933] mock_open does not support iteration around text files.

2018-09-13 Thread Berker Peksag
Berker Peksag added the comment: Ned, as release manager of 3.6 and 3.7, what do you think about backporting this to maintenance releases? -- ___ Python tracker ___

[issue32933] mock_open does not support iteration around text files.

2018-09-12 Thread Anthony Flury
Anthony Flury added the comment: Berker, Thanks for your work on getting this complete. I would strongly support backporting if possible. 3.5 and 3.6 will be in common use for a while (afaik 3.6 has only now got delivered to Ubuntu as the default Python 3), and this does fix does allow full

[issue32933] mock_open does not support iteration around text files.

2018-09-12 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the patch, Anthony.I consider this a new feature, so I removed 3.6 and 3.7 from the versions field. We can backport to 3.7 if other core developers think that it's worth to fix in the latest maintenance branch. -- resolution: -> fixed

[issue32933] mock_open does not support iteration around text files.

2018-09-12 Thread Berker Peksag
Berker Peksag added the comment: New changeset 2087023fdec2c89070bd14f384a3c308c548a94a by Berker Peksag (Tony Flury) in branch 'master': bpo-32933: Implement __iter__ method on mock_open() (GH-5974) https://github.com/python/cpython/commit/2087023fdec2c89070bd14f384a3c308c548a94a

[issue32933] mock_open does not support iteration around text files.

2018-07-09 Thread Anthony Flury
Anthony Flury added the comment: But the __next__ is a method on the iterator; So long as __iter__ returns a valid iterator (which it does in my pull request), it will by definition support __next___ Although it is entirely possible that I have misunderstood what you are saying.

[issue32933] mock_open does not support iteration around text files.

2018-07-09 Thread Berker Peksag
Berker Peksag added the comment: This is basically a duplicate of bpo-21258, but I haven't closely look at the patches in both issues yet. We should probably consider adding support for __next__ as well. -- nosy: +berker.peksag ___ Python tracker

[issue32933] mock_open does not support iteration around text files.

2018-06-22 Thread Ned Deily
Ned Deily added the comment: Anthony's PR is awaiting merge. Although Yury has reviewed it, as the core developers mocktest experts, it would be good if Michael and/or Robert could also take a look. -- nosy: +ned.deily ___ Python tracker

[issue32933] mock_open does not support iteration around text files.

2018-04-06 Thread Anthony Flury
Anthony Flury added the comment: No - it isn't related. In the case of mock_open; it isn't intended to be a simple MagicMock - it is meant to be a mocked version of open, and so to be useful as a testing tool, it should emulate a file as much as possible.

[issue32933] mock_open does not support iteration around text files.

2018-04-06 Thread Éric Araujo
Éric Araujo added the comment: Is this related to #33236 ? -- nosy: +eric.araujo ___ Python tracker ___

[issue32933] mock_open does not support iteration around text files.

2018-03-04 Thread Anthony Flury
Change by Anthony Flury : -- pull_requests: +5743 ___ Python tracker ___ ___

[issue32933] mock_open does not support iteration around text files.

2018-03-04 Thread bbayles
Change by bbayles : -- nosy: +bbayles ___ Python tracker ___ ___ Python-bugs-list mailing

[issue32933] mock_open does not support iteration around text files.

2018-03-04 Thread Anthony Flury
Change by Anthony Flury : -- pull_requests: +5742 ___ Python tracker ___ ___

[issue32933] mock_open does not support iteration around text files.

2018-03-04 Thread Anthony Flury
Change by Anthony Flury : -- pull_requests: +5741 ___ Python tracker ___ ___

[issue32933] mock_open does not support iteration around text files.

2018-03-04 Thread Anthony Flury
Change by Anthony Flury : -- keywords: +patch pull_requests: +5740 stage: -> patch review ___ Python tracker ___

[issue32933] mock_open does not support iteration around text files.

2018-03-02 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: +ezio.melotti, michael.foord, rbcollins versions: +Python 3.8 -Python 3.4, Python 3.5 ___ Python tracker

[issue32933] mock_open does not support iteration around text files.

2018-02-25 Thread Anthony Flury
Change by Anthony Flury : -- type: -> behavior ___ Python tracker ___ ___

[issue32933] mock_open does not support iteration around text files.

2018-02-24 Thread Anthony Flury
New submission from Anthony Flury : Using the unittest.mock helper mock_open with multi-line read data, although readlines method will work on the mocked open data, the commonly used iterator idiom on an open file returns the equivalent of an empty file. from