[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: +cjw296

___
Python tracker 
<https://bugs.python.org/issue44534>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/issue43478>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/issue3722>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/c598a04dd29b89ad072245ddaf738badcfb41ac7


--

___
Python tracker 
<https://bugs.python.org/issue42532>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 of get_type_hints that users of the function don't have 
to know about.

That said, I've only hit this so far when writing a unit test, but will update 
this issue if I see real-world cases of this.

--

___
Python tracker 
<https://bugs.python.org/issue41872>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 type:

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/typing.py:1001: 
in get_type_hints
value = _eval_type(value, globalns, localns)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/typing.py:260: 
in _eval_type
return t._evaluate(globalns, localns)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/typing.py:464: 
in _evaluate
eval(self.__forward_code__, globalns, localns),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   NameError: name 'Foo' is not defined

--
components: Library (Lib)
messages: 377569
nosy: cjw296
priority: normal
severity: normal
status: open
title: get_type_hints fails to resolve forward references in nested function
type: behavior
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue41872>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 for this?

I'd be fine to see this bug closed with "wontfix", but will leave it open for 
now in case others feel strongly differently.

--

___
Python tracker 
<https://bugs.python.org/issue41403>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.

The only "helper" in the section you refer to is 
https://docs.python.org/3/library/unittest.mock.html#mock-open which I'd 
consider vestigal and a bit of a maintenance magnet.

--

___
Python tracker 
<https://bugs.python.org/issue40133>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 prefer not to see this 
merged.

"We've been using these internally at Google for years" is not a compelling 
argument and suggests you already have a viable solution which doesn't involve 
merging these into the core repo. Your phrasing could be interpreted as 
somewhat bullying - "it's right for Google, so I'm going to do it for all of 
Python in spite of comments from other core contributors, and I don't want to 
discuss this on a mailing list because that will take too long".

Please consider re-closing this issue and respecting the decisions of those of 
us who maintain mock long-term. If not, please suggest a way forward to mediate 
this disagreement, but please do not unilaterally merge anything without 
sorting this out first.

--

___
Python tracker 
<https://bugs.python.org/issue40133>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 ;-)

--

___
Python tracker 
<https://bugs.python.org/issue40805>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 you see if this is reproducible on Python 3.8 or 3.9, replacing 
`from mock import` with `from unittest.mock` import?

--
nosy: +cjw296

___
Python tracker 
<https://bugs.python.org/issue40805>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/cpython/commit/521c8d6806adf0305c158d280ec00cca48e8ab22


--

___
Python tracker 
<https://bugs.python.org/issue39966>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/cpython/commit/521c8d6806adf0305c158d280ec00cca48e8ab22


--

___
Python tracker 
<https://bugs.python.org/issue25597>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 the current position in a future release.

--

___
Python tracker 
<https://bugs.python.org/issue39966>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 [2].

[0] 
https://testfixtures.readthedocs.io/en/latest/comparing.html#the-compare-function
[1] 
https://testfixtures.readthedocs.io/en/latest/comparing.html#comparison-objects
[2] 
https://testfixtures.readthedocs.io/en/latest/comparing.html#string-comparison-objects

Diego, would you be okay if we closed this issue and the accompanying pull 
request?

--

___
Python tracker 
<https://bugs.python.org/issue40133>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/f6bdac1bf718eab0cc5b6554f363f21252d245ce


--

___
Python tracker 
<https://bugs.python.org/issue39915>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/e553f204bf0e39b1d701a364bc71b286acb9433f


--

___
Python tracker 
<https://bugs.python.org/issue39915>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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?

--
title: inspecting a partial with bound keywods gives incorrect signature -> 
inspecting a partial with bound keywords gives incorrect signature

___
Python tracker 
<https://bugs.python.org/issue39753>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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__'

--

___
Python tracker 
<https://bugs.python.org/issue39753>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 partial
>>> def foo(x, y, z, a=None): pass
... 
>>> p = partial(foo, 1, y=2)
>>> from inspect import signature
>>> signature(p).parameters.values()
odict_values([, , ])

That  shouldn't be in there:

>>> p(2, y=3)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: foo() got multiple values for argument 'y'

--
messages: 362656
nosy: cjw296
priority: normal
severity: normal
status: open
title: inspecting a partial with bound keywods gives incorrect signature

___
Python tracker 
<https://bugs.python.org/issue39753>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 your usecase?

Keep the unit test though, useful to show in mock why the change is needed, and 
make sure we do something sensible in the backport!

--

___
Python tracker 
<https://bugs.python.org/issue39551>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 to 
explain this to me?

When "It can still have normal Python modules as a child which aren't 
immutable", what happens when you try to patch the immutable module? What 
happens if you try to patch the mutable module below it?

When "the assignment is ignored with a warning.", what is doing that ignoring?

Unless I'm missing something, this feels like such an edge case I'm not sure 
mock.patch should be trying to support it. Should this be something that is 
handled by your immutable import thing?

--

___
Python tracker 
<https://bugs.python.org/issue39551>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue39551>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/issue31826>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/02395fad8e3a35ef00fa31c308693844013a1dd4


--

___
Python tracker 
<https://bugs.python.org/issue39450>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/7561e7a83f5118fda6c62fe9c8c3458f8cfd


--

___
Python tracker 
<https://bugs.python.org/issue39450>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/032de7324e30c6b44ef272cea3be205a3d768759


--
nosy: +cjw296

___
Python tracker 
<https://bugs.python.org/issue39450>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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


--

___
Python tracker 
<https://bugs.python.org/issue37972>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue39485>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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


--

___
Python tracker 
<https://bugs.python.org/issue39485>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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


--

___
Python tracker 
<https://bugs.python.org/issue39485>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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


--

___
Python tracker 
<https://bugs.python.org/issue39485>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/72b1004657e60c900e4cd031b2635b587f4b280e


--

___
Python tracker 
<https://bugs.python.org/issue25597>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/19be85c76503535c101b38194d282187de0ff631


--

___
Python tracker 
<https://bugs.python.org/issue39082>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue38932>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/aef7dc89879d099dc704bd8037b8a7686fb72838


--

___
Python tracker 
<https://bugs.python.org/issue38932>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue37955>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/40c080934b3d49311209b1cb690c2ea1e04df7e7


--
nosy: +cjw296

___
Python tracker 
<https://bugs.python.org/issue37955>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue39082>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/62865f4532094017a9b780b704686ca9734bc329


--
nosy: +cjw296

___
Python tracker 
<https://bugs.python.org/issue39082>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/66b00a9d3aacf6ed49412f48743e4913104a2bb3


--

___
Python tracker 
<https://bugs.python.org/issue38473>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue21600>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue37669>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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, and an 
example included in the docs as suggested above.

Also, be aware that there can be better options for mocking files. 
https://github.com/jmcgeheeiv/pyfakefs/ and 
https://docs.pytest.org/en/latest/tmpdir.html would be my recommendation.

--

___
Python tracker 
<https://bugs.python.org/issue37669>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/1d0c5e16eab29d55773cc4196bb90d2bf12e09dd


--

___
Python tracker 
<https://bugs.python.org/issue24928>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/issue24928>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.

--

___
Python tracker 
<https://bugs.python.org/issue39222>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/issue39222>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue38669>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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


--

___
Python tracker 
<https://bugs.python.org/issue38669>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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


--

___
Python tracker 
<https://bugs.python.org/issue38669>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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


--

___
Python tracker 
<https://bugs.python.org/issue38669>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 and 
confusing.

--
nosy: +cjw296

___
Python tracker 
<https://bugs.python.org/issue30463>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue38757>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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:
> 
> 
> Karthikeyan Singaravelan  added the comment:
> 
> Currently, the exception is not instantiated. Maybe we can check if it's 
> callable and pass args, kwargs to the exception constructor to be raised.
> 
> diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
> index a48132c5b1..f5bcb911f5 100644
> --- a/Lib/unittest/mock.py
> +++ b/Lib/unittest/mock.py
> @@ -1145,7 +1145,10 @@ class CallableMixin(Base):
> effect = self.side_effect
> if effect is not None:
> if _is_exception(effect):
> -raise effect
> +if _callable(effect):
> +raise effect(*args, **kwargs)
> +else:
> +raise effect
> elif not _callable(effect):
> result = next(effect)
> if _is_exception(result):
> 
> --
> nosy: +cjw296, lisroach, mariocj89, michael.foord
> 
> ___
> Python tracker 
> <https://bugs.python.org/issue38757>
> ___

--

___
Python tracker 
<https://bugs.python.org/issue38757>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/38d311d79e57479f7a684c2cd298293033dc4990


--

___
Python tracker 
<https://bugs.python.org/issue36871>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/be310e03d0b84ef56e9d35b0b1b21d685b7ea371


--

___
Python tracker 
<https://bugs.python.org/issue36871>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/c96127821ebda50760e788b1213975a0d5bea37f


--

___
Python tracker 
<https://bugs.python.org/issue36871>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/cpython/commit/e9b187a2bfbb0586fc5d554ce745b7fe04e0b9a8


--

___
Python tracker 
<https://bugs.python.org/issue21478>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/cpython/commit/22fd679dc363bfcbda336775da16aff4d6fcb33f


--

___
Python tracker 
<https://bugs.python.org/issue21478>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/7397cda99795a4a8d96193d710105e77a07b7411


--

___
Python tracker 
<https://bugs.python.org/issue21478>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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?

--

___
Python tracker 
<https://bugs.python.org/issue37107>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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)
Requirement already up-to-date: pip in 
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages 
(18.1)

But:

$ python3.7 -m venv /tmp/test_venv
$ /tmp/test_venv/bin/pip --version
pip 10.0.1 from /private/tmp/test_venv/lib/python3.7/site-packages/pip (python 
3.7)

--
components: Library (Lib)
messages: 344029
nosy: cjw296
priority: normal
severity: normal
status: open
title: ensurepip --upgrade doesn't change the version of pip used by venv
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue37107>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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?

--

___
Python tracker 
<https://bugs.python.org/issue36848>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 by pointing to that issue.

thoughts?

--

___
Python tracker 
<https://bugs.python.org/issue36848>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/commit/a6516f89aa0f416c7514ac364bb48ac7d1455487


--

___
Python tracker 
<https://bugs.python.org/issue31855>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/11a8832c98b3db78727312154dd1d3ba76d639ec


--

___
Python tracker 
<https://bugs.python.org/issue31855>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/b0df45e55dc8304bac0e3cad0225472b84190964


--

___
Python tracker 
<https://bugs.python.org/issue21269>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/ea199b90bb61866cd3c2f154341d1eb0d5c4a710


--

___
Python tracker 
<https://bugs.python.org/issue35512>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/a875ea58b29fbf510f9790ae1653eeaa47dc0de8


--

___
Python tracker 
<https://bugs.python.org/issue35512>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/d358a8cda75446a8e0b5d99149f709395d5eae19


--

___
Python tracker 
<https://bugs.python.org/issue20239>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/222d303ade8aadf0adcae5190fac603bdcafe3f0


--

___
Python tracker 
<https://bugs.python.org/issue20239>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue26704>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/6a12931c9cb5d472fe6370dbcd2bde72f34dddb4


--

___
Python tracker 
<https://bugs.python.org/issue17185>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue32153>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue17185>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/f7fa62ef4422c9deee050a794fd8504640d9f8f4


--

___
Python tracker 
<https://bugs.python.org/issue17185>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/issue26704>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 prevalent testing framework now, doesn't want to rely on them 
(they do come with a lot of baggage ;-)).

Can we make use of the pretty diffing stuff in unittest without explicitly 
making it a requirement?

[1] https://docs.pytest.org/en/latest/assert.html

[2] https://testfixtures.readthedocs.io/en/latest/comparing.html#dicts

[3] 
https://docs.python.org/3.8/library/unittest.html#unittest.TestCase.assertDictEqual

--

___
Python tracker 
<https://bugs.python.org/issue28054>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/issue26704>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.org/issue35330>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/ee2c5a8e2dcf662048dbcf4e49af9b4aaf81f7d3


--

___
Python tracker 
<https://bugs.python.org/issue35330>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/12b9fb603eea9298c835bae5b8742db4fa52892e


--

___
Python tracker 
<https://bugs.python.org/issue35330>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/f05df0a4b679d0acfd0b1fe6187ba2d553b37afa


--

___
Python tracker 
<https://bugs.python.org/issue35330>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/70ca3fce9fe2bdd7bf97d5fe1299cfa5e32b3ad4


--

___
Python tracker 
<https://bugs.python.org/issue35357>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/commit/12735c14134082584b899308af8dd8fcc9f15696


--

___
Python tracker 
<https://bugs.python.org/issue35357>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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/e63e617ebbe481c498bdf037a62e09f4f9f3963f


--

___
Python tracker 
<https://bugs.python.org/issue35357>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 passing, then I'd say you're 
there!

--
versions: +Python 3.6, Python 3.7

___
Python tracker 
<https://bugs.python.org/issue17185>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   >