[issue44534] unittest.mock.Mock.unsafe doc is garbled

2021-07-05 Thread Chris Withers
Chris Withers added the comment: New changeset abb08e3af6aa19928007a349592e95e6de38467f by Jack DeVries in branch 'main': bpo-44534: fix wording and docstring sync in unittest.Mock GH27000 https://github.com/python/cpython/commit/abb08e3af6aa19928007a349592e95e6de38467f -- nosy

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Chris Withers
Chris Withers added the comment: I agree that this should raise an exception. Can the two failing tests in mock's own suite be easily fixed? -- ___ Python tracker <https://bugs.python.org/issue43

[issue3722] print followed by exception eats print with doctest

2020-12-20 Thread Chris Withers
Change by Chris Withers : -- keywords: -easy ___ Python tracker <https://bugs.python.org/issue3722> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue3722] print followed by exception eats print with doctest

2020-12-20 Thread Chris Withers
Chris Withers added the comment: @iritkatriel - if Tim thinks this is hard, it probably is hard ;-) -- ___ Python tracker <https://bugs.python.org/issue3

[issue42532] spec_arg's __bool__ is called while initializing NonCallableMock

2020-12-06 Thread Chris Withers
Chris Withers added the comment: New changeset c598a04dd29b89ad072245ddaf738badcfb41ac7 by idanw206 in branch 'master': bpo-42532: Check if NonCallableMock's spec_arg is not None instead of call its __bool__ function (GH23613) https://github.com/python/cpython/commit

[issue41872] get_type_hints fails to resolve forward references in nested function

2020-09-27 Thread Chris Withers
Chris Withers added the comment: The tough one is that no-one wants an ugly sys._getframe() call, but by avoiding it in the standard library, we force each library that needs this to have the ugly sys._getframe() call rather than it being an unpleasant implementation detail

[issue41872] get_type_hints fails to resolve forward references in nested function

2020-09-27 Thread Chris Withers
New submission from Chris Withers : Reproducer: def test_forward_type_references(self): def foo(a: 'Foo') -> 'Bar': pass class Foo: pass class Bar: pass get_type_hints(foo) The above gives the following exception, rather than resolving the t

[issue41403] Uncaught AttributeError in unittest.mock._get_target

2020-07-27 Thread Chris Withers
Chris Withers added the comment: Given that `mock.patch` is being used incorrectly here, the error message seems clear enough: It's saying there's a `Foo` object in place, and `rsplit` gives a strong indication that a string was expected. Would adding type hints in mock.py be a resolution

[issue40133] Provide additional matchers for unittest.mock

2020-06-23 Thread Chris Withers
Chris Withers added the comment: Okay, but to be up-front about this, I don't see any place in the stdlib for any more "helpers" that could more easily be maintained on pypi and wouldn't incur further support burden for anyone looking after this part of the standard library.

[issue40133] Provide additional matchers for unittest.mock

2020-06-18 Thread Chris Withers
Chris Withers added the comment: Gregory, I find your response a little troubling. Myself and Karthikeyan both do a lot of work on Mock, some might even say we're the maintainers of Mock in both cpython's core repo and the backport. We both feel this belongs standalone on pypi, and would

[issue40805] Can no longer patch flask.g

2020-06-03 Thread Chris Withers
Chris Withers added the comment: Rob, you're welcome to dump `mock` and use `unittest.mock`, and that might be best for now, but this will then likely come back to bite you when you end up on the version of Python, probably 3.9, where it is present

[issue40805] Can no longer patch flask.g

2020-06-03 Thread Chris Withers
Change by Chris Withers : -- status: closed -> open ___ Python tracker <https://bugs.python.org/issue40805> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue40805] Can no longer patch flask.g

2020-06-03 Thread Chris Withers
Chris Withers added the comment: Terry, mock is now a rolling backport of unittest.mock with all development taking place in cpython's repo. If issues are reported there, they need to be triaged here first, as it's most likely a bug in unittest.mock that needs fixing here. Rob, please can

[issue39966] mock 3.9 bug: Wrapped objects without __bool__ raise exception

2020-04-28 Thread Chris Withers
Chris Withers added the comment: New changeset 521c8d6806adf0305c158d280ec00cca48e8ab22 by Karthikeyan Singaravelan in branch 'master': bpo-39966: Revert "bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock" (GH-19734) https://github.com/python/cpyt

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2020-04-28 Thread Chris Withers
Chris Withers added the comment: New changeset 521c8d6806adf0305c158d280ec00cca48e8ab22 by Karthikeyan Singaravelan in branch 'master': bpo-39966: Revert "bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock" (GH-19734) https://github.com/python/cpyt

[issue39966] mock 3.9 bug: Wrapped objects without __bool__ raise exception

2020-04-27 Thread Chris Withers
Chris Withers added the comment: I'd go with your instincts on what to do next, I'd have a slight preference to keeping behaviour the same as it was in 3.8 if the changes for 3.9 cause more problems. That leaves us no worse off than we were before, and with the opportunity to improve from

[issue40133] Provide additional matchers for unittest.mock

2020-04-16 Thread Chris Withers
Chris Withers added the comment: Agreed, this would be better placed in a third party library. There's examples out there already, for example, I maintain a library [0] that has tools for asserting about complex data structures, including flexible type matching [1] and regex string matching

[issue39915] await_args_list in AsyncMock always refers to the last awaited call object

2020-03-14 Thread Chris Withers
Chris Withers added the comment: New changeset f6bdac1bf718eab0cc5b6554f363f21252d245ce by Miss Islington (bot) in branch '3.8': bpo-39915: Ensure await_args_list is updated according to the order in which coroutines were awaited (GH-18927) https://github.com/python/cpython/commit

[issue39915] await_args_list in AsyncMock always refers to the last awaited call object

2020-03-11 Thread Chris Withers
Chris Withers added the comment: New changeset e553f204bf0e39b1d701a364bc71b286acb9433f by Karthikeyan Singaravelan in branch 'master': bpo-39915: Ensure await_args_list is updated according to the order in which coroutines were awaited (GH-18924) https://github.com/python/cpython/commit

[issue39753] inspecting a partial with bound keywords gives incorrect signature

2020-03-01 Thread Chris Withers
Chris Withers added the comment: Not sure I understand your comment. The results of calling inpsect on a partial with bound keyword parameters are incorrect. Furthermore, it is surprisingly that partial objects don't maintain their own __signature__. What is it you're suggesting

[issue39753] inspecting a partial with bound keywods gives incorrect signature

2020-02-25 Thread Chris Withers
Chris Withers added the comment: Surprised partials have no explicit signature: >>> p.__signature__ Traceback (most recent call last): File "", line 1, in AttributeError: 'functools.partial' object has no attribute '__signature__' -- ___

[issue39753] inspecting a partial with bound keywods gives incorrect signature

2020-02-25 Thread Chris Withers
Change by Chris Withers : -- components: +Library (Lib) versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue39753> ___ ___ Python-bugs-list m

[issue39753] inspecting a partial with bound keywods gives incorrect signature

2020-02-25 Thread Chris Withers
New submission from Chris Withers : $ python Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from functools import part

[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules

2020-02-09 Thread Chris Withers
Chris Withers added the comment: Hmm, the more we get into this, the less comfortable I am of the patch in the PR. Instead of copying and pasting more code that's likely to get out of sync, could you change the PR to just replace _importer with the correct parts of importlib to support

[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules

2020-02-06 Thread Chris Withers
Chris Withers added the comment: Apologies, but I'm still not sure what "the modules are published" means? "publish "x" as a child onto the package" also doesn't mean much to me, I'm afraid. Are you aware of any importlib docs or some such which might be able

[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules

2020-02-04 Thread Chris Withers
Chris Withers added the comment: I'm afraid I don't understand "immutable package which doesn't allow it's children to be published on it", can you give an example? -- ___ Python tracker <https://bugs.python.o

[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules

2020-02-04 Thread Chris Withers
Chris Withers added the comment: What's the real world use case for this? -- nosy: +cjw296 ___ Python tracker <https://bugs.python.org/issue39551> ___ ___ Pytho

[issue31826] Misleading __version__ attribute of modules in standard library

2020-02-04 Thread Chris Withers
Change by Chris Withers : -- keywords: +patch pull_requests: +17717 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17977 ___ Python tracker <https://bugs.python.org/issu

[issue39450] unittest TestCase shortDescription does not strip whitespace

2020-02-03 Thread Chris Withers
Chris Withers added the comment: New changeset 02395fad8e3a35ef00fa31c308693844013a1dd4 by Miss Islington (bot) in branch '3.8': bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175) (#18323) https://github.com/python/cpython/commit

[issue39450] unittest TestCase shortDescription does not strip whitespace

2020-02-02 Thread Chris Withers
Chris Withers added the comment: New changeset 7561e7a83f5118fda6c62fe9c8c3458f8cfd by Miss Islington (bot) in branch '3.7': bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18321) https://github.com/python/cpython/commit

[issue39450] unittest TestCase shortDescription does not strip whitespace

2020-02-02 Thread Chris Withers
Chris Withers added the comment: New changeset 032de7324e30c6b44ef272cea3be205a3d768759 by Steve Cirelli in branch 'master': bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175) https://github.com/python/cpython/commit

[issue37972] unittest.mock.call does not chain __getitem__ to another _Call object

2020-01-29 Thread Chris Withers
Chris Withers added the comment: New changeset db5e86adbce12350c26e7ffc2c6673369971a2dc by Chris Withers in branch 'master': Get mock coverage back to 100% (GH-18228) https://github.com/python/cpython/commit/db5e86adbce12350c26e7ffc2c6673369971a2dc

[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers
Chris Withers added the comment: Thank you very much for this, that was a really good catch! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers
Chris Withers added the comment: New changeset 696d2324cf2a54e20e8d6a6739fa97ba815a8be9 by Miss Islington (bot) in branch '3.8': bpo-39485: fix corner-case in method-detection of mock (GH-18255) https://github.com/python/cpython/commit/696d2324cf2a54e20e8d6a6739fa97ba815a8be9

[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers
Chris Withers added the comment: New changeset cf0645a17acbc0c4dbbf82434e37637965748bbb by Miss Islington (bot) in branch '3.7': bpo-39485: fix corner-case in method-detection of mock (GH-18256) https://github.com/python/cpython/commit/cf0645a17acbc0c4dbbf82434e37637965748bbb

[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers
Chris Withers added the comment: New changeset a327677905956ae0b239ff430a1346dfe265709e by Carl Friedrich Bolz-Tereick in branch 'master': bpo-39485: fix corner-case in method-detection of mock (GH-18252) https://github.com/python/cpython/commit/a327677905956ae0b239ff430a1346dfe265709e

[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers
Change by Chris Withers : -- assignee: -> cjw296 ___ Python tracker <https://bugs.python.org/issue39485> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2020-01-26 Thread Chris Withers
Chris Withers added the comment: New changeset 72b1004657e60c900e4cd031b2635b587f4b280e by Chris Withers (Karthikeyan Singaravelan) in branch 'master': bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock (#16029) https://github.com/python/cpython/commit

[issue39082] AsyncMock is unable to correctly patch static or class methods

2020-01-26 Thread Chris Withers
Chris Withers added the comment: New changeset 19be85c76503535c101b38194d282187de0ff631 by Chris Withers (Matthew Kokotovich) in branch '3.8': [3.8] bpo-39082: Allow AsyncMock to correctly patch static/class methods (GH-18190) https://github.com/python/cpython/commit

[issue38932] unittest.mock.Mock.reset_mocks does not pass all arguments to its children

2020-01-25 Thread Chris Withers
Change by Chris Withers : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue38932] unittest.mock.Mock.reset_mocks does not pass all arguments to its children

2020-01-25 Thread Chris Withers
Chris Withers added the comment: New changeset aef7dc89879d099dc704bd8037b8a7686fb72838 by Chris Withers (Vegard Stikbakke) in branch 'master': bpo-38932: Mock fully resets child objects on reset_mock(). (GH-17409) https://github.com/python/cpython/commit

[issue37955] mock.patch incorrect reference to Mock

2020-01-25 Thread Chris Withers
Change by Chris Withers : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue37955] mock.patch incorrect reference to Mock

2020-01-25 Thread Chris Withers
Chris Withers added the comment: New changeset 40c080934b3d49311209b1cb690c2ea1e04df7e7 by Chris Withers (Paulo Henrique Silva) in branch 'master': bpo-37955: correct mock.patch docs with respect to the returned type (GH-15521) https://github.com/python/cpython/commit

[issue39082] AsyncMock is unable to correctly patch static or class methods

2020-01-25 Thread Chris Withers
Change by Chris Withers : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue39082] AsyncMock is unable to correctly patch static or class methods

2020-01-25 Thread Chris Withers
Chris Withers added the comment: New changeset 62865f4532094017a9b780b704686ca9734bc329 by Chris Withers (Matthew Kokotovich) in branch 'master': bpo-39082: Allow AsyncMock to correctly patch static/class methods (GH-18116) https://github.com/python/cpython/commit

[issue38473] AttributeError on asserting autospecced mock object added using attach_mock

2020-01-24 Thread Chris Withers
Chris Withers added the comment: New changeset 66b00a9d3aacf6ed49412f48743e4913104a2bb3 by Chris Withers (Karthikeyan Singaravelan) in branch 'master': bpo-38473: Handle autospecced functions and methods used with attach_mock (GH-16784) https://github.com/python/cpython/commit

[issue21600] mock.patch.stopall doesn't work with patch.dict

2020-01-24 Thread Chris Withers
Change by Chris Withers : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue37669] Make mock_open return per-file content

2020-01-24 Thread Chris Withers
Chris Withers added the comment: Closing in favour of issue38157. -- resolution: -> duplicate stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue37669] Make mock_open return per-file content

2020-01-24 Thread Chris Withers
Chris Withers added the comment: I'm not sure I like the API feel after this change: two parameters that can't be used at the same time. As Karthikeyan points out, this can be achieved using side_effect. Personally, I'd prefer a PR that adds a unit test showing that this approach works

[issue24928] mock.patch.dict spoils order of items in collections.OrderedDict

2020-01-24 Thread Chris Withers
Chris Withers added the comment: New changeset 1d0c5e16eab29d55773cc4196bb90d2bf12e09dd by Chris Withers (Emmanuel Arias) in branch 'master': bpo-24928: Add test case for patch.dict using OrderedDict (GH -11437) https://github.com/python/cpython/commit

[issue24928] mock.patch.dict spoils order of items in collections.OrderedDict

2020-01-24 Thread Chris Withers
Chris Withers added the comment: As I said before, I can't see an additional test like this hurting, especially if it highlights problems with earlier python versions when it's backported. -- ___ Python tracker <https://bugs.python.org/issue24

[issue39222] unittest.mock.Mock.parent is broken or undocumented

2020-01-12 Thread Chris Withers
Chris Withers added the comment: Ah right. Well, it's called `parent` in the __init__ as that's what the attribute used to be called. My suggestion would be to add `parent` to the docs @xtreak links to as a way to resolve this issue

[issue39222] unittest.mock.Mock.parent is broken or undocumented

2020-01-10 Thread Chris Withers
Chris Withers added the comment: I thought we'd already changed this to _mock_parent in the last year or so? -- ___ Python tracker <https://bugs.python.org/issue39

[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread Chris Withers
Change by Chris Withers : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread Chris Withers
Chris Withers added the comment: New changeset 41973c99fdfdc78315e819661e279bdcc2f058b1 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-38669: patch.object now raises a helpful error (GH17511) https://github.com/python/cpython/commit/41973c99fdfdc78315e819661e279bdcc2f058b1

[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread Chris Withers
Chris Withers added the comment: New changeset 4594565b56e9c99d2d3fb7549041bbca5ecba8e2 by Chris Withers (Miss Islington (bot)) in branch '3.8': bpo-38669: patch.object now raises a helpful error (GH17510) https://github.com/python/cpython/commit/4594565b56e9c99d2d3fb7549041bbca5ecba8e2

[issue38669] patch.object should raise another error when first argument is a str

2019-12-08 Thread Chris Withers
Chris Withers added the comment: New changeset cd90a52983db34896a6335a572d55bdda274778f by Chris Withers (Elena Oat) in branch 'master': bpo-38669: patch.object now raises a helpful error (GH17034) https://github.com/python/cpython/commit/cd90a52983db34896a6335a572d55bdda274778f

[issue30463] Add __slots__ to ABC convenience class

2019-11-15 Thread Chris Withers
Chris Withers added the comment: I will note that this means with: class BaseClass(ABC): pass class MyDerivedClass(BaseClass): def __init__(self, thing): self.thing = thing thing = MyDerivedClass() thing now has both __slots__ and, evidently, a dict. That's a bit weird

[issue38763] mock with side effect : assert_called_once returns None while call_count returns 1

2019-11-12 Thread Chris Withers
Change by Chris Withers : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue38763> ___ ___

[issue38757] mocking an exception, arguments do not seem to be passed to the mock

2019-11-11 Thread Chris Withers
Chris Withers added the comment: Agreed. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue38757] mocking an exception, arguments do not seem to be passed to the mock

2019-11-09 Thread Chris Withers
Chris Withers added the comment: Not sure this is correct, if an effect is an exception and requires args, then it should be passed as an instance, not a class: Mock(side_effect=MyException(‘foo’)) > On 10 Nov 2019, at 04:49, Karthikeyan Singaravelan > wrote: > > &

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-29 Thread Chris Withers
Chris Withers added the comment: New changeset 38d311d79e57479f7a684c2cd298293033dc4990 by Chris Withers (Miss Islington (bot)) in branch '3.8': bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH15578) https://github.com/python/cpython/commit

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-29 Thread Chris Withers
Chris Withers added the comment: New changeset be310e03d0b84ef56e9d35b0b1b21d685b7ea371 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH15577) https://github.com/python/cpython/commit

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-29 Thread Chris Withers
Chris Withers added the comment: New changeset c96127821ebda50760e788b1213975a0d5bea37f by Chris Withers (Xtreak) in branch 'master': bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH13261) https://github.com/python/cpython/commit

[issue21478] mock calls don't propagate to parent (autospec)

2019-07-22 Thread Chris Withers
Chris Withers added the comment: New changeset e9b187a2bfbb0586fc5d554ce745b7fe04e0b9a8 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-21478: Record calls to parent when autospecced objects are used as child with attach_mock (GH 14688) (GH-14903) https://github.com/python

[issue21478] mock calls don't propagate to parent (autospec)

2019-07-22 Thread Chris Withers
Chris Withers added the comment: New changeset 22fd679dc363bfcbda336775da16aff4d6fcb33f by Chris Withers (Miss Islington (bot)) in branch '3.8': bpo-21478: Record calls to parent when autospecced objects are used as child with attach_mock (GH 14688) (GH-14902) https://github.com/python

[issue21478] mock calls don't propagate to parent (autospec)

2019-07-22 Thread Chris Withers
Chris Withers added the comment: New changeset 7397cda99795a4a8d96193d710105e77a07b7411 by Chris Withers (Xtreak) in branch 'master': bpo-21478: Record calls to parent when autospecced objects are used as child with attach_mock (GH 14688) https://github.com/python/cpython/commit

[issue37107] ensurepip --upgrade doesn't change the version of pip used by venv

2019-06-09 Thread Chris Withers
Chris Withers added the comment: I don't suppose there's any chance we can treat the misnaming of these options as the bugs they feel like, so so fix them for 3.7+, rather than having people battle on with the confusion for another 3+ years until 3.9 is mainstream

[issue37107] ensurepip --upgrade doesn't change the version of pip used by venv

2019-05-31 Thread Chris Withers
New submission from Chris Withers : $ python3.7 -m ensurepip --upgrade Looking in links: /var/folders/m6/tsd59qsj7pd_lldh4mhwh6khgn/T/tmpqk_vncev Requirement already up-to-date: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (39.0.1

[issue21820] unittest: unhelpful truncating of long strings.

2019-05-08 Thread Chris Withers
Change by Chris Withers : -- versions: +Python 3.7, Python 3.8, Python 3.9 -Python 3.4 ___ Python tracker <https://bugs.python.org/issue21820> ___ ___ Python-bug

[issue36848] autospec fails with AttributeError when mocked class has __signature__ non-writeable

2019-05-08 Thread Chris Withers
Chris Withers added the comment: We only attempt to set __signature__ on Mocks, so I don't think extensions will be a problem. I do think there's a bit of code smell on that method: it's called _check_* and then changes some attributes, that might be worth fixing

[issue36848] autospec fails with AttributeError when mocked class has __signature__ non-writeable

2019-05-08 Thread Chris Withers
Chris Withers added the comment: I'm not sure we should try and work around this; hijacking __signature__ python-wide is going to cause a bunch of other problems. My vote would be to just open a bug on the pyside tracker (wherever that is) and close the issue and and on the backport

[issue36848] autospec fails with AttributeError when mocked class has __signature__ non-writeable

2019-05-08 Thread Chris Withers
Chris Withers added the comment: Wow, is this just an issue that the pyside guys need to fix? -- ___ Python tracker <https://bugs.python.org/issue36848> ___ ___

[issue31855] mock_open is not compatible with read(n) (and pickle.load)

2019-05-07 Thread Chris Withers
Chris Withers added the comment: New changeset a6516f89aa0f416c7514ac364bb48ac7d1455487 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-31855: unittest.mock.mock_open() results now respects the argument of read([size]) (GH-11521) (#13152) https://github.com/python/cpython

[issue31855] mock_open is not compatible with read(n) (and pickle.load)

2019-05-07 Thread Chris Withers
Chris Withers added the comment: New changeset 11a8832c98b3db78727312154dd1d3ba76d639ec by Chris Withers (Rémi Lapeyre) in branch 'master': bpo-31855: unittest.mock.mock_open() results now respects the argument of read([size]) (GH-11521) https://github.com/python/cpython/commit

[issue21269] Provide args and kwargs attributes on mock call objects

2019-03-22 Thread Chris Withers
Chris Withers added the comment: New changeset b0df45e55dc8304bac0e3cad0225472b84190964 by Chris Withers (Kumar Akshay) in branch 'master': bpo-21269: Provide args and kwargs attributes on mock call objects GH11807 https://github.com/python/cpython/commit

[issue35512] patch.dict resolves in_dict eagerly (should be late resolved)

2019-02-25 Thread Chris Withers
Chris Withers added the comment: New changeset ea199b90bb61866cd3c2f154341d1eb0d5c4a710 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-35512: Resolve string target to patch.dict decorator during function call GHGH-12000 (#12021) https://github.com/python/cpython/commit

[issue35512] patch.dict resolves in_dict eagerly (should be late resolved)

2019-02-24 Thread Chris Withers
Chris Withers added the comment: New changeset a875ea58b29fbf510f9790ae1653eeaa47dc0de8 by Chris Withers (Xtreak) in branch 'master': bpo-35512: Resolve string target to patch.dict decorator during function call GH#12000 https://github.com/python/cpython/commit

[issue20239] Allow repeated deletion of unittest.mock.Mock attributes

2019-01-21 Thread Chris Withers
Chris Withers added the comment: New changeset d358a8cda75446a8e0b5d99149f709395d5eae19 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-20239: Allow repeated deletion of unittest.mock.Mock attributes (GH-11629) https://github.com/python/cpython/commit

[issue20239] Allow repeated deletion of unittest.mock.Mock attributes

2019-01-21 Thread Chris Withers
Chris Withers added the comment: New changeset 222d303ade8aadf0adcae5190fac603bdcafe3f0 by Chris Withers (Pablo Galindo) in branch 'master': bpo-20239: Allow repeated deletion of unittest.mock.Mock attributes (#11057) https://github.com/python/cpython/commit

[issue35500] Align expected and actual calls on mock.assert_called_with error message

2018-12-24 Thread Chris Withers
Change by Chris Withers : -- Removed message: https://bugs.python.org/msg332464 ___ Python tracker <https://bugs.python.org/issue35500> ___ ___ Python-bugs-list m

[issue35500] Align expected and actual calls on mock.assert_called_with error message

2018-12-24 Thread Chris Withers
Change by Chris Withers : -- Removed message: https://bugs.python.org/msg332462 ___ Python tracker <https://bugs.python.org/issue35500> ___ ___ Python-bugs-list m

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-12 Thread Chris Withers
Change by Chris Withers : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue17185] unittest mock create_autospec doesn't correctly replace mocksignature

2018-12-12 Thread Chris Withers
Chris Withers added the comment: New changeset 6a12931c9cb5d472fe6370dbcd2bde72f34dddb4 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-17185: Add __signature__ to mock that can be used by inspect for signature (GH11125) https://github.com/python/cpython/commit

[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-12-12 Thread Chris Withers
Chris Withers added the comment: Yep! Good catch :-) -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue17185] unittest mock create_autospec doesn't correctly replace mocksignature

2018-12-11 Thread Chris Withers
Change by Chris Withers : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue17185] unittest mock create_autospec doesn't correctly replace mocksignature

2018-12-11 Thread Chris Withers
Chris Withers added the comment: New changeset f7fa62ef4422c9deee050a794fd8504640d9f8f4 by Chris Withers (Xtreak) in branch 'master': bpo-17185: Add __signature__ to mock that can be used by inspect for signature (GH11048) https://github.com/python/cpython/commit

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-10 Thread Chris Withers
Chris Withers added the comment: Ah, yeah, I can see the blanket patch and a more local patch in a monorepo being a thing, cool, let's have a look! -- ___ Python tracker <https://bugs.python.org/issue26

[issue24928] mock.patch.dict spoils order of items in collections.OrderedDict

2018-12-10 Thread Chris Withers
Chris Withers added the comment: More tests are generally a good thing, so go for it :-) -- ___ Python tracker <https://bugs.python.org/issue24928> ___ ___ Pytho

[issue28054] Diff for visually comparing actual with expected in mock.assert_called_with.

2018-12-10 Thread Chris Withers
Chris Withers added the comment: This is a tricky one as there's plenty of prior art, with pytest's assertion rewriting [1], testfixtures compare [2] and the stuff that unittest already does [3]. I don't think any solution should rely on a TestCase being used as pytest, which is the most

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2018-12-10 Thread Chris Withers
Chris Withers added the comment: Before we get too far: what's the use case for this double patching? -- ___ Python tracker <https://bugs.python.org/issue26

[issue35330] When using mock to wrap an existing object, side_effect requires return_value

2018-12-08 Thread Chris Withers
Change by Chris Withers : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue35330] When using mock to wrap an existing object, side_effect requires return_value

2018-12-08 Thread Chris Withers
Chris Withers added the comment: New changeset ee2c5a8e2dcf662048dbcf4e49af9b4aaf81f7d3 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-35330: Don't call the wrapped object if `side_effect` is set (GH11035) https://github.com/python/cpython/commit

[issue35330] When using mock to wrap an existing object, side_effect requires return_value

2018-12-08 Thread Chris Withers
Chris Withers added the comment: New changeset 12b9fb603eea9298c835bae5b8742db4fa52892e by Chris Withers (Miss Islington (bot)) in branch '3.6': bpo-35330: Don't call the wrapped object if `side_effect` is set (GH11034) https://github.com/python/cpython/commit

[issue35330] When using mock to wrap an existing object, side_effect requires return_value

2018-12-08 Thread Chris Withers
Chris Withers added the comment: New changeset f05df0a4b679d0acfd0b1fe6187ba2d553b37afa by Chris Withers (Mario Corchero) in branch 'master': bpo-35330: Don't call the wrapped object if `side_effect` is set (GH10973) https://github.com/python/cpython/commit

[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread Chris Withers
Chris Withers added the comment: New changeset 70ca3fce9fe2bdd7bf97d5fe1299cfa5e32b3ad4 by Chris Withers (Miss Islington (bot)) in branch '3.6': bpo-35357: Add _mock_ prefix to name/parent/from_kall attributes of _Call/_MagicProxy. (GH-10873) https://github.com/python/cpython/commit

[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread Chris Withers
Chris Withers added the comment: New changeset 12735c14134082584b899308af8dd8fcc9f15696 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-35357: Add _mock_ prefix to name/parent/from_kall attributes of _Call/_MagicProxy. (GH-10873) (#10887) https://github.com/python/cpython

[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread Chris Withers
Change by Chris Withers : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35357> ___ ___ Pyth

[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread Chris Withers
Chris Withers added the comment: New changeset e63e617ebbe481c498bdf037a62e09f4f9f3963f by Chris Withers (Andrew Dunai) in branch 'master': bpo-35357: Add _mock_ prefix to name/parent/from_kall attributes of _Call/_MagicProxy. (#10873) https://github.com/python/cpython/commit

[issue17185] unittest mock create_autospec doesn't correctly replace mocksignature

2018-12-03 Thread Chris Withers
Chris Withers added the comment: xtreak - great to see action on this! First step would be to add a unit test for the failure case I reported. I like the tests you have too, but would be good to see the specific failure case covered too. Beyond that, if we can get all the the new tests

  1   2   3   >