[issue42159] AsyncMock restores stopped patch if same object stopped multiple times

2020-10-26 Thread Lisa Roach


New submission from Lisa Roach :

Hard to explain in the title, easier to see via a test case:

 async def async_func():
 raise Exception

def test_simultaneous_mocks(self):
class Test(IsolatedAsyncioTestCase):
async def test_test(self):
patcher1 = patch(f"{__name__}.async_func")
patcher2 = patch(f"{__name__}.async_func")
patcher1.start()
await async_func()
patcher2.start()
await async_func()
patcher1.stop()
with self.assertRaises(Exception):
await async_func()
patcher2.stop()
with self.assertRaises(Exception): # Fails, mock is restored!
await async_func()

test = Test("test_test")
output = test.run()
self.assertTrue(output.wasSuccessful()) # Fail


Calling stop() on the second patch actually restores the mock and causes the 
test to fail.

--
assignee: lisroach
messages: 379687
nosy: lisroach
priority: normal
severity: normal
status: open
title: AsyncMock restores stopped patch if same object stopped multiple times
versions: Python 3.10, Python 3.8, Python 3.9

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



[issue39101] IsolatedAsyncioTestCase freezes when exception is raised

2020-10-26 Thread Lisa Roach


Change by Lisa Roach :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue39101] IsolatedAsyncioTestCase freezes when exception is raised

2020-10-26 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 8374d2ee1589791be8892b00f4bbf8121dde24bd by Lisa Roach in branch 
'master':
bpo-39101: Fixes BaseException hang in IsolatedAsyncioTestCase. (GH-22654)
https://github.com/python/cpython/commit/8374d2ee1589791be8892b00f4bbf8121dde24bd


--

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



[issue39706] unittest.IsolatedAsyncioTestCase hangs on asyncio.CancelledError

2020-10-26 Thread Lisa Roach


Change by Lisa Roach :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue39706] unittest.IsolatedAsyncioTestCase hangs on asyncio.CancelledError

2020-10-26 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
nosy: +lisroach
nosy_count: 3.0 -> 4.0
pull_requests: +21902
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22654

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



[issue42072] requests

2020-10-19 Thread Lisa Roach


Lisa Roach  added the comment:

Requests is a third-party library (https://pypi.org/project/requests/2.7.0/), 
it is not a part of CPython so this is not the correct forum to report bugs. 
They have their own issue tracker here: https://github.com/psf/requests/issues

I'd also suggest a permission error is not a bug in Requests, but perhaps a 
permission issue that is local to your machine. Perhaps searching around 
StackOverflow can offer you some guidance.

--
nosy: +lisroach
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue41954] [mock] Recursion on mocking inspect.isfunction

2020-10-19 Thread Lisa Roach


Lisa Roach  added the comment:

Oof yeah, sorry my commit broke this but it is pretty hard to avoid. Mario is 
right in that it would be messy and challenging to ensure anything mocked from 
the stdlib doesn't also break mock itself.  

I want to mark this as `wont fix`, unless there is a compelling reason for the 
stdlib's `inspect.isfunction` to be mockable. But I agree with Mario again 
here, it would be better to mock the module that is using the function rather 
than the built-in function itself.

--

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



[issue42038] Tracemalloc's format() doc contradictory

2020-10-14 Thread Lisa Roach


New submission from Lisa Roach :

Tracemalloc's format documentation 
(https://docs.python.org/3/library/tracemalloc.html#tracemalloc.Traceback.format)
 says first:

"Format the traceback as a list of lines with newlines."

then:

"Similar to the traceback.format_tb() function, except that format() does not 
include newlines."

The first statement is incorrect, tracemalloc does NOT add newlines to the 
list. I recommend just removing the "with newlines" in the first statement.

--
assignee: docs@python
components: Documentation
messages: 378636
nosy: docs@python, lisroach
priority: low
severity: normal
status: open
title: Tracemalloc's format() doc contradictory
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue42038] Tracemalloc's format() doc contradictory

2020-10-14 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +easy, newcomer friendly

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



[issue39101] IsolatedAsyncioTestCase freezes when exception is raised

2020-10-11 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
nosy: +lisroach
nosy_count: 3.0 -> 4.0
pull_requests: +21630
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22654

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



[issue38857] AsyncMock issue with awaitable return_value/side_effect/wraps

2019-11-21 Thread Lisa Roach


Change by Lisa Roach :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue38859] AsyncMock says it raises StopIteration but that is Impossible

2019-11-21 Thread Lisa Roach


Lisa Roach  added the comment:

PR merged, thanks Jason!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue38857] AsyncMock issue with awaitable return_value/side_effect/wraps

2019-11-20 Thread Lisa Roach


Change by Lisa Roach :


--
pull_requests: +16796
pull_request: https://github.com/python/cpython/pull/17304

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



[issue38857] AsyncMock issue with awaitable return_value/side_effect/wraps

2019-11-20 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 046442d02bcc6e848e71e93e47f6cde9e279e993 by Lisa Roach (Jason 
Fried) in branch 'master':
bpo-38857: AsyncMock fix for awaitable values and StopIteration fix [3.8] 
(GH-17269)
https://github.com/python/cpython/commit/046442d02bcc6e848e71e93e47f6cde9e279e993


--

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



[issue38753] AsyncMock not cited as new in 3.8

2019-11-19 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 279d8df5e5e8bbd4429420649359f7afcb4c8cce by Lisa Roach (John 
Belmonte) in branch 'master':
bpo-38753: AsyncMock added in version 3.8 (GH-17102)
https://github.com/python/cpython/commit/279d8df5e5e8bbd4429420649359f7afcb4c8cce


--

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



[issue38163] AsyncMock child mocks should detect their type

2019-09-29 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 21f24ead90c22d0e2c2ebf14a64b37d99de54b33 by Lisa Roach in branch 
'3.8':
[3.8] bpo-38163: Child mocks detect their type as sync or async (GH-16471) 
(GH-16484)
https://github.com/python/cpython/commit/21f24ead90c22d0e2c2ebf14a64b37d99de54b33


--

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



[issue38163] AsyncMock child mocks should detect their type

2019-09-29 Thread Lisa Roach


Change by Lisa Roach :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue38163] AsyncMock child mocks should detect their type

2019-09-29 Thread Lisa Roach


Change by Lisa Roach :


--
pull_requests: +16069
pull_request: https://github.com/python/cpython/pull/16484

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



[issue38163] AsyncMock child mocks should detect their type

2019-09-29 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 3667e1ee6c90e6d3b6a745cd590ece87118f81ad by Lisa Roach in branch 
'master':
bpo-38163: Child mocks detect their type as sync or async (GH-16471)
https://github.com/python/cpython/commit/3667e1ee6c90e6d3b6a745cd590ece87118f81ad


--

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



[issue38161] AsyncMock add `.awaited` like `.called`

2019-09-29 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 36e7e4aabb662e86e9dace1a6447492f45868654 by Lisa Roach (Miss 
Islington (bot)) in branch '3.8':
bpo-38161: Removes _AwaitEvent from AsyncMock. (GH-16443) (GH-16481)
https://github.com/python/cpython/commit/36e7e4aabb662e86e9dace1a6447492f45868654


--

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



[issue38136] Remove AsyncMock.assert_awaited_*

2019-09-29 Thread Lisa Roach


Change by Lisa Roach :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue38093] Update MagicMock __aenter__ and __aexit__ to return AsyncMock's

2019-09-29 Thread Lisa Roach


Change by Lisa Roach :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue38108] Everything in Mock should inherit from Base

2019-09-29 Thread Lisa Roach


Change by Lisa Roach :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue38108] Everything in Mock should inherit from Base

2019-09-29 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset b76ab352405df105c2d459fc66ef8dc98e47b37c by Lisa Roach (Miss 
Islington (bot)) in branch '3.8':
bpo-38108: Makes mock objects inherit from Base (GH-16060) (GH-16470)
https://github.com/python/cpython/commit/b76ab352405df105c2d459fc66ef8dc98e47b37c


--

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



[issue38161] AsyncMock add `.awaited` like `.called`

2019-09-29 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 25e115ec00b5f75e3589c9f21013c47c21e1753f by Lisa Roach in branch 
'master':
bpo-38161: Removes _AwaitEvent from AsyncMock. (GH-16443)
https://github.com/python/cpython/commit/25e115ec00b5f75e3589c9f21013c47c21e1753f


--

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



[issue38163] AsyncMock child mocks should detect their type

2019-09-28 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
pull_requests: +16054
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16471

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



[issue38108] Everything in Mock should inherit from Base

2019-09-28 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 9a7d9519506ae807ca48ff02e2ea117ebac3450e by Lisa Roach in branch 
'master':
bpo-38108: Makes mock objects inherit from Base (GH-16060)
https://github.com/python/cpython/commit/9a7d9519506ae807ca48ff02e2ea117ebac3450e


--

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



[issue38161] AsyncMock add `.awaited` like `.called`

2019-09-27 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
pull_requests: +16023
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16443

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



[issue38161] AsyncMock add `.awaited` like `.called`

2019-09-27 Thread Lisa Roach


Lisa Roach  added the comment:

Looking at this more, I think I want to just remove the current `awaited` 
object. The PR in asyntest makes it seem pretty cool: 
https://github.com/Martiusweb/asynctest/issues/64

But I have issue with the naming (await_event is probably better for us), and 
I'm not sure how to document it well and ensure it's well tested.

With the 3.8 release coming up fast I'd rather remove it for now and then add 
it back in after some more thought has been given to the feature, instead of 
getting stuck with a not fully thought out attribute we have to worry about 
deprecating.

--

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



[issue38136] Remove AsyncMock.assert_awaited_*

2019-09-27 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 52bdd414ed9da7c62c312c542803753986a0040a by Lisa Roach in branch 
'3.8':
[3.8] bpo-38136: Updates await_count and call_count to be different things 
(GH-16192) (GH-16431)
https://github.com/python/cpython/commit/52bdd414ed9da7c62c312c542803753986a0040a


--

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



[issue38136] Remove AsyncMock.assert_awaited_*

2019-09-26 Thread Lisa Roach


Change by Lisa Roach :


--
pull_requests: +16010
pull_request: https://github.com/python/cpython/pull/16431

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



[issue38163] AsyncMock child mocks should detect their type

2019-09-25 Thread Lisa Roach


Lisa Roach  added the comment:

Lately I have been having my doubts around having MagicMocks also create 
AsyncMocks as children. 

Should a MagicMock really have a __aenter__ magic method? 
Is this too far from the original MagicMock if we change child mocks to default 
not to their parent type, but to their parent type *or* AsyncMock if 
asynchronous?

It makes the using the mocks easier, since you can just use MagicMock or 
AsyncMock for whatever you are doing and not think about when to use which. But 
it also might make the code more confusing, since it isn't as clear when to use 
one or the other.

--

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



[issue38163] AsyncMock child mocks should detect their type

2019-09-25 Thread Lisa Roach

Lisa Roach  added the comment:

This should be simple to do, after https://github.com/python/cpython/pull/16060 
we can add:

elif self._mock_methods and _new_name in self._mock_methods:
# Methods that are not in _spec_asyncs are normal methods
klass = MagicMock

to _get_child_mocks and test with:

def test_normal_methods_on_class(self):
am = AsyncMock(AsyncClass)
self.assertIsInstance(am.async_method, AsyncMock)
self.assertIsInstance(am.normal_method, MagicMock)

This might be starting to make _get_child_mocks too complicated, and no longer 
follows the default "child mocks are the same as their parent". I am not sure 
how to redefine _get_child_mocks without needing to double up a lot of code to 
support MagicMocks having AsyncMock child_mocks as well.

--

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



[issue38136] Remove AsyncMock.assert_awaited_*

2019-09-23 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset ef048517755db1f0d211fb6dfc655a8b412cc96f by Lisa Roach in branch 
'master':
bpo-38136: Updates await_count and call_count to be different things (GH-16192)
https://github.com/python/cpython/commit/ef048517755db1f0d211fb6dfc655a8b412cc96f


--

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



[issue38093] Update MagicMock __aenter__ and __aexit__ to return AsyncMock's

2019-09-20 Thread Lisa Roach


Change by Lisa Roach :


--
pull_requests: +15885
pull_request: https://github.com/python/cpython/pull/16299

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



[issue38093] Update MagicMock __aenter__ and __aexit__ to return AsyncMock's

2019-09-19 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 8b03f943c37e07fb2394acdcfacd066647f9b1fd by Lisa Roach in branch 
'master':
bpo-38093: Correctly returns AsyncMock for async subclasses. (GH-15947)
https://github.com/python/cpython/commit/8b03f943c37e07fb2394acdcfacd066647f9b1fd


--

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



[issue38161] AsyncMock add `.awaited` like `.called`

2019-09-19 Thread Lisa Roach


Lisa Roach  added the comment:

Yeah I think the current `awaited` ought to at least be a private variable, 
since people will assume it works like a boolean to match `.called`. Then we 
could add a new, proper, `awaited` that would function like:

>>> mock = AsyncMock()
>>> cr_mock = mock()
>>> mock.called
True
>>> mock.awaited
False
>>> await cr_mock
>>> mock.awaited
True

--

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



[issue38100] Spelling error in unittest.mock code

2019-09-16 Thread Lisa Roach

Lisa Roach  added the comment:

(y) Thanks for looking into it Stéphane!

--

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



[issue38136] Remove AsyncMock.assert_awaited_*

2019-09-16 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
pull_requests: +15798
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16192

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



[issue38100] Spelling error in unittest.mock code

2019-09-16 Thread Lisa Roach


Lisa Roach  added the comment:

It helps to comment on the issue before making a PR for it to claim it, as now 
we have 3 PRs all for the same issue :) We will likely accept the first PR that 
was created (or in this case the first PR that gets a CLA signed for it)

--

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



[issue38163] AsyncMock child mocks should detect their type

2019-09-13 Thread Lisa Roach


New submission from Lisa Roach :

We want child mocks to match their "type" (async or sync). 

Ex:

class Prod:
   async def foo():
  pass
def bar():
   pass

a_mock = AsyncMock(Prod)
isinstance(a_mock.foo(), AsyncMock) == True
isinstance(a_mock.bar(), MagicMock) == True

Also this should include magic methods:

int(a_mock) should work and return 1 like MagicMocks do.
a_mock.__enter__ should exist and be a MagicMock, just as a_mock.__aenter__ 
exists and is an AsyncMock.

--
messages: 352369
nosy: lisroach
priority: normal
severity: normal
status: open
title: AsyncMock child mocks should detect their type

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



[issue38161] AsyncMock add `.awaited` like `.called`

2019-09-13 Thread Lisa Roach


New submission from Lisa Roach :

Currently Mock has a `.called` attribute, we could add an equivalent `.awaited` 
that returns True or False if the object has been awaited on.

--
messages: 352345
nosy: lisroach
priority: normal
severity: normal
status: open
title: AsyncMock add `.awaited` like `.called`

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



[issue17013] Allow waiting on a mock

2019-09-12 Thread Lisa Roach


Change by Lisa Roach :


--
nosy: +lisroach

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



[issue38108] Everything in Mock should inherit from Base

2019-09-12 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
pull_requests: +15683
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16060

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



[issue38136] Remove AsyncMock.assert_awaited_*

2019-09-12 Thread Lisa Roach


Lisa Roach  added the comment:

Going to try to recap an in-person conversation:

There are some cases where calls are made separate from when they are awaited, 
for example:
   >>> call = foo()
   >>> await call

This would be 1 call and 1 await:

Call List   Await List
-   --
[foo][call]

Calls like:
   >>> await foo()

Should also be counted as 1 call and 1 await, there is no difference between 
this call and the call above (expect for slight differences in when the lists 
are updated):

Call List   Await List
-   --
[foo][call] 


If someone were to do this:

  >>>call_1 = foo()
  >>>call_2 = foo()

  >>> await call_1
  >>> await foo(x)

We should see 2 calls added to the call list, then 1 await added to the await 
list, then 1 call added to the call list and 1 await added to the await list. 
We would end up with 3 calls and 2 awaits. 

Call List  Await List
- --
[foo, foo, foo][call_1, foo]


And a call without an await:
 
  >>> call = foo()

Call List  Await List
- --
[foo] []



With a setup like this, we would keep the API the same (leaving in the 
assert_await*). There is some risk that users will incorrectly be using 
assert_call* when they really want to test awaits, but we can try to make to 
docs as clear as possible around this.

--

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



[issue38136] Remove AsyncMock.assert_awaited_*

2019-09-12 Thread Lisa Roach


New submission from Lisa Roach :

After some discussion about call_count vs await_count, I believe call_count 
should be counting when things are *awaited* (await foo()), not when they are 
*called* (foo()). 

I think people expect "calling" to execute the code and give them a 
return_value, which for asyncio is what happens when you await, not when you 
call with (). If people disagree about this I am open to discussion, we can 
change the current functionality and leave in the assert_awaited_* calls.

Currently the code does count asyncio calls when they are awaited, but this 
makes the assert_awaited_* calls redundant. 

We should remove these in favor of the call_count_* functions.

--
assignee: lisroach
components: Library (Lib)
messages: 352144
nosy: cjw296, ezio.melotti, lisroach, michael.foord, xtreak
priority: normal
severity: normal
status: open
title: Remove AsyncMock.assert_awaited_*
type: behavior
versions: Python 3.8, Python 3.9

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



[issue38122] AsyncMock force always creating an AsyncMock for child mocks

2019-09-11 Thread Lisa Roach


New submission from Lisa Roach :

This idea has been brought up in person before and also discussed on AsyncTest: 
https://github.com/Martiusweb/asynctest/issues/100


It could be useful if someone has a lot of attributes that are also async that 
need to be mocked. 

It could probably be done with a flag that gets passed on to _get_child_mock 
and overrides the if statement to always return an AsyncMock.


Looking mostly for if people think this is a good idea/bad idea and help see 
around any corners that may be there.

--
assignee: lisroach
components: Library (Lib)
messages: 351991
nosy: cjw296, ezio.melotti, lisroach, michael.foord, xtreak
priority: low
severity: normal
status: open
title: AsyncMock force always creating an AsyncMock for child mocks
type: behavior

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



[issue38108] Everything in Mock should inherit from Base

2019-09-11 Thread Lisa Roach


Lisa Roach  added the comment:

Also:

_AsyncIterator
_AwaitEvent

Some of the code in AsyncMagicMixin might be able to be simplified if we 
inherit from MagicMixin instead, right now we might be duplicating work.

In general we have to watch out for duplication/overwriting of attributes with 
this change.

--

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



[issue38093] Update MagicMock __aenter__ and __aexit__ to return AsyncMock's

2019-09-11 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
pull_requests: +15582
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/15947

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



[issue38108] Everything in Mock should inherit from Base

2019-09-11 Thread Lisa Roach


New submission from Lisa Roach :

Everything within Mock should be inheriting from the top-level parent class, 
Base (and properly call super).

For multiple inheritance to work correctly they all should be inheriting from 
the same parent class ultimately. 

Classes that need update:

MagicMixin
AsyncMagicMixin
NonCallableMock (instance = object.__new__(new) should be switched to a super 
call here)

--
assignee: lisroach
messages: 351863
nosy: ezio.melotti, lisroach, michael.foord, xtreak
priority: normal
severity: normal
status: open
title: Everything in Mock should inherit from Base
versions: Python 3.8, Python 3.9

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



[issue38103] Duplicate label "examples" in the Docs

2019-09-11 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 2d8d597bb8f882a7677db5a2739df0e617098634 by Lisa Roach (Ezio 
Melotti) in branch 'master':
bpo-38103: fix conflicting labels in the docs. (GH-15906)
https://github.com/python/cpython/commit/2d8d597bb8f882a7677db5a2739df0e617098634


--
nosy: +lisroach

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



[issue38101] Update devguide triaging keywords

2019-09-11 Thread Lisa Roach


New submission from Lisa Roach :

Currently the devguide triaging keywords page is out of date: 

https://devguide.python.org/triaging/#keywords

It is missing keywords like "easy (C)", "security_issue", and "pep3121".

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 351781
nosy: docs@python, lisroach
priority: normal
severity: normal
status: open
title: Update devguide triaging keywords

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



[issue38100] Spelling error in unittest.mock code

2019-09-11 Thread Lisa Roach


New submission from Lisa Roach :

Good first issue.

There is a spelling error in the unittest.mock library, "return_calulator" 
should be "return_calculator".

This is in the `_set_return_value` method in `Lib/unittest/mock.py`.

--
components: Library (Lib)
keywords: easy, newcomer friendly
messages: 351778
nosy: lisroach
priority: low
severity: normal
status: open
title: Spelling error in unittest.mock code

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



[issue38093] Update MagicMock __aenter__ and __aexit__ to return AsyncMock's

2019-09-10 Thread Lisa Roach


New submission from Lisa Roach :

After a discussion with Michael, xtreak, and Ezio we've decided to try to make 
the process of mocking an async context manager slightly easier.

Currently if you want to mock a context manager that is used like this:

async with cm():  # note that cm is called here
  blah

You need to mock cm as a MagicMock and set __aenter__ and __aexit__ return 
values directly because they do not exist on MagicMocks.


Our first step to making this easier is setting the calculated return value of 
MagicMock __aenter__ and __aexit__ to be AsyncMock, which will make it so you 
do not need to set them specifically.


A future improvement may be to create a ContextManagerMock directly that can 
take an async kwarg that would return a context manager with AsyncMocks for 
__aenter__ and __aexit__ automatically.

--
assignee: lisroach
messages: 351682
nosy: ezio.melotti, lisroach, michael.foord, xtreak
priority: normal
severity: normal
stage: needs patch
status: open
title: Update MagicMock __aenter__ and __aexit__ to return AsyncMock's
type: behavior
versions: Python 3.8, Python 3.9

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



[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2019-09-10 Thread Lisa Roach


Change by Lisa Roach :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

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



[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2019-09-10 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset f1a297acb60b88917712450ebd3cfa707e6efd6b by Lisa Roach in branch 
'master':
bpo-37251: Removes __code__ check from _is_async_obj. (GH-15830)
https://github.com/python/cpython/commit/f1a297acb60b88917712450ebd3cfa707e6efd6b


--

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



[issue37052] Add examples for mocking async for and async context manager in unittest.mock docs

2019-09-10 Thread Lisa Roach


Lisa Roach  added the comment:

I think this is a great addition! Ezio and I were chatting about trying to add 
an example where the child mocks are also AsyncMocks, since by default they 
will be MagicMocks. Adding him to nosy.

--
nosy: +ezio.melotti

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



[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2019-09-10 Thread Lisa Roach


Change by Lisa Roach :


--
pull_requests: +15476
pull_request: https://github.com/python/cpython/pull/15830

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



[issue37383] call count in not registered in AsyncMock till the coroutine is awaited

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset b9f65f01fd761da7799f36d29b54518399d3458e by Lisa Roach in branch 
'master':
bpo-37383: Updates docs to reflect AsyncMock call_count after await. (#15761)
https://github.com/python/cpython/commit/b9f65f01fd761da7799f36d29b54518399d3458e


--

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



[issue30782] Allow limiting the number of concurrent tasks in asyncio.as_completed

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:

Oh nice, I remember talking to you about the MultiError before, it will
help simplify some Mock things. Happy to help out if you want more eyes on
it.

On Mon, Sep 9, 2019 at 3:46 PM Yury Selivanov 
wrote:

>
> Yury Selivanov  added the comment:
>
> FWIW I've been using TaskGroups in EdgeDB codebase extensively:
> https://github.com/edgedb/edgedb/blob/master/edb/common/taskgroup.py (you
> can use the code, it's Apache 2)
>
> The only thing that prevented us from merging them in 3.8 is that we need
> to formally define & implement ExceptionGroup (or MultiError) in CPython.
> I'm going to work on an initial PEP for that this week.
>
> --
>
> ___
> Python tracker 
> <https://bugs.python.org/issue30782>
> ___
>

--

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



[issue30782] Allow limiting the number of concurrent tasks in asyncio.as_completed

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:

Sounds good, thanks for the explanation Yury. I look forward to the TaskGroups!

--

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



[issue30782] Allow limiting the number of concurrent tasks in asyncio.as_completed

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:

I would like to see this implemented. I run into memory and speed issues when 
running with 1000+ tasks quite frequently, and have to write my own rate 
limiters around it.

It doesn't look to me that it is adding a large amount of complexity to 
as_completed. This was closed in 2017, perhaps it is worth revisiting?

--
nosy: +lisroach

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



[issue38054] enhance pdb.set_trace() to run when the specified condition is true

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:

Does this flag make things much easier? You would still need an if statement in 
order to correctly pass in True/False for the trigger flag.

--
nosy: +lisroach

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



[issue37383] call count in not registered in AsyncMock till the coroutine is awaited

2019-09-09 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
pull_requests: +15414
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15761

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



[issue37383] call count in not registered in AsyncMock till the coroutine is awaited

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:

I think you are right, I'd prefer to leave it in. It also helps users who are 
switching from AsyncTest to the std lib AsyncMock, they can keep using 
`await_count`. I'll update the docs!

--

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



[issue37383] call count in not registered in AsyncMock till the coroutine is awaited

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:

I wonder if `await_count` is really necessary, since it is essentially the same 
as `call_count`. Would it be too late or confusing to remove it now?

--

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



[issue37383] call count in not registered in AsyncMock till the coroutine is awaited

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:

Agreed, I think documentation can be clearer around this. I'll add a PR to try 
to clarify.

--

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



[issue37383] call count in not registered in AsyncMock till the coroutine is awaited

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:

I see your point it is confusing the difference between the async and sync API, 
but I think the current AsyncMock call check is correct. According to the 
asyncio docs: "...simply calling a coroutine will not schedule it to be 
executed" (https://docs.python.org/3/library/asyncio-task.html#coroutines) and 
it goes on to say you either need to call the function with await, 
asyncio.run(), or asyncio.create_task(). 

So I believe calling an AsyncMock without using await should not log as a call, 
it is only if one of the three criteria above is met that it should be added to 
the mock_calls list.

--

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



[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2019-09-09 Thread Lisa Roach


Lisa Roach  added the comment:

I made a new branch with the changes I am suggesting here to try to be more 
clear: https://github.com/lisroach/cpython/tree/issue37251

What do you think?

--

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



[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2019-06-25 Thread Lisa Roach


Lisa Roach  added the comment:

Yes, sorry I wasn't clear, I was thinking about the functions and testing 
without your PR. I think removing the __code__ object (or working around it) is 
the correct way to go, but just removing it wouldn't solve this particular 
problem.

"If I understand the awaitable examples correctly, mocking the obj which is an 
Awaitable should be returning an AsyncMock. But obj doesn't contain __code__ 
and hence check for inspect.isawaitable is never done causing 
_is_async_obj(obj) to return False and subsequently it's patched with 
MagicMock."

Exactly! This is why I think technically removing the __code__ check is 
correct. Probably removing the __code__ attribute for any AsyncMock that is 
mocking an async object and not an async function is best, but I don't know how 
I would do that. 

I may also be misunderstanding some asyncio concepts, that is just what I 
observed :)


What if instead of checking for the __code__ object at all we check if there it 
is a Mock object (excluding AsyncMock):


def _is_async_obj(obj):
sync_mocks = [MagicMock, Mock, PropertyMock, NonCallableMock, 
NonCallableMagicMock]
if (any(isinstance(obj, sync_mock) for sync_mock in sync_mocks)
and not isinstance(obj, AsyncMock)):
return False
return asyncio.iscoroutinefunction(obj) or inspect.isawaitable(obj)

--

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



[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2019-06-19 Thread Lisa Roach


Lisa Roach  added the comment:

Thanks for the patch!

To answer your question, I do not think we can remove _is_async_func in favor 
of _is_async_obj, _is_async_obj will evaluate to True in cases where 
_is_async_func would not. 

For example:

>>> class NewCoroutine(Awaitable):
... def __await__():
... pass
...
>>> c = NewCoroutine()
>>> import inspect
>>> inspect.isawaitable(c)
True
>>> inspect.iscoroutinefunction(c)
False


BUT I think removing the `if getattr(obj, '__code__', None)` from 
`_is_async_obj` actually makes this work correctly. It is possible for a 
coroutine object to not have a __code__, but I don't think it is possible for a 
coroutine function to be missing a __code__. 

Before removing the __code__ check:

>>> from unittest.mock import _is_async_func, _is_async_obj
>>> import asyncio
>>> _is_async_obj(asyncio.sleep(1))
:1: RuntimeWarning: coroutine 'sleep' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
False
>>> _is_async_func(asyncio.sleep(1))
False

_is_async_obj evaluates to False when it should be True

After removing it:

>>> from unittest.mock import _is_async_func, _is_async_obj
>>> import asyncio
>>> _is_async_obj(asyncio.sleep(1))
:1: RuntimeWarning: coroutine 'sleep' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
True
>>> _is_async_func(asyncio.sleep(1))
False

It correctly evaluates to True

All tests pass as well. What do you think?

--

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



[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2019-06-12 Thread Lisa Roach


Lisa Roach  added the comment:

Following up from xtreak's proposal 
(https://github.com/python/cpython/pull/9296) I think checking if __code__ is 
actually a CodeType is a good idea. It's simple and doesn't change any other 
functionality in an unwanted way.

--

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



[issue24412] setUpClass equivalent for addCleanup

2019-06-10 Thread Lisa Roach


Change by Lisa Roach :


--
stage: patch review -> resolved
status: open -> closed

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



[issue36996] unittest.mock.patch decorator doesn't work with async functions

2019-05-21 Thread Lisa Roach


Lisa Roach  added the comment:

Oops, didn't see your post. Thanks!

--

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



[issue36996] unittest.mock.patch decorator doesn't work with async functions

2019-05-21 Thread Lisa Roach


Lisa Roach  added the comment:

I quickly threw in Andrew's code to check it and looks like it does fix the 
problem. I'd be happy to add it in but I'll give @xtreak first dibs.

Thanks for finding this :)

--

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



[issue26467] Add async magic method support to unittest.mock.Mock

2019-05-20 Thread Lisa Roach


Lisa Roach  added the comment:

Added and AsyncMock class which supports mocking async magic methods.

--
stage: patch review -> resolved
status: open -> closed

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



[issue26467] Add async magic method support to unittest.mock.Mock

2019-05-20 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 77b3b7701a34ecf6316469e05b79bb91de2addfa by Lisa Roach in branch 
'master':
bpo-26467: Adds AsyncMock for asyncio Mock library support (GH-9296)
https://github.com/python/cpython/commit/77b3b7701a34ecf6316469e05b79bb91de2addfa


--
nosy: +lisroach

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



[issue35924] curses segfault resizing window

2019-05-17 Thread Lisa Roach


Lisa Roach  added the comment:

Thank you for all the work you did on this Toshio! I think we are good to close 
this issue.

--
stage: patch review -> resolved

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2019-05-07 Thread Lisa Roach


Change by Lisa Roach :


--
pull_requests:  -13094

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2019-05-07 Thread Lisa Roach


Change by Lisa Roach :


--
pull_requests: +13096

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2019-05-07 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
pull_requests: +13094
stage: test needed -> patch review

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2019-04-29 Thread Lisa Roach


Lisa Roach  added the comment:

+1, I think tests should run the same way in debug() and run(), the difference 
being limited only to how the result is handled. 

Marking a test as skipped should still be skipped while debugging, else it 
pollutes the results with tests that will not run with run().

--
nosy: +lisroach

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



[issue36654] Add example to tokenize.tokenize

2019-04-24 Thread Lisa Roach


Lisa Roach  added the comment:

This could be added to the examples section of the tokenize doc, would you want 
to make the PR Windson?

--
nosy: +lisroach

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



[issue36541] Make lib2to3 grammar more closely match Python

2019-04-24 Thread Lisa Roach


Lisa Roach  added the comment:

I agree we should get lib2to3 up to date.

Looks like for *args and **kwargs there is issue33348 (this has a PR) and 
issue32496 (no PR) and related closed issue24791 and issue24176. 

Adding `:=` seems straighforward to me, as for the big change maybe 
@benjamin.peterson would be interested in commenting?

--
nosy: +lisroach

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



[issue35924] curses segfault resizing window

2019-03-11 Thread Lisa Roach


Lisa Roach  added the comment:

I am able to confirm the repro, I haven't been able to find the root cause of 
it yet though. Trying to dig into it.

--
nosy: +lisroach

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



[issue36159] Modify Formatter Class to handle arbitrary objects

2019-03-11 Thread Lisa Roach


Lisa Roach  added the comment:

Can you give an example use case for this? F-strings are the newer method of 
string interpolation, I'm not sure it's worth putting effort into adding 
features to string.Formatter.

--
nosy: +lisroach

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



[issue35132] python-gdb error: Python Exception Type does not have a target

2019-03-11 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 1ceb3a3d172dcf0ddff38d5d6b559443ad065b84 by Lisa Roach in branch 
'master':
bpo-35132: Fixes missing target in gdb pep0393 check. (GH-11848)
https://github.com/python/cpython/commit/1ceb3a3d172dcf0ddff38d5d6b559443ad065b84


--

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



[issue20774] collections.deque should ship with a stdlib json serializer

2019-03-05 Thread Lisa Roach


Lisa Roach  added the comment:

Serhiy might be right, it looks significantly worse with benchmarking:

lisroach$ python3 -m timeit "import json; json.dumps(['test'])"
10 loops, best of 3: 2.73 usec per loop

lisroach$ ./python.exe -m timeit "import json; json.dumps(['test'])"
1 loops, best of 5: 21.2 usec per loop

lisroach$ python3 -m timeit "import json; json.dumps(1)"
10 loops, best of 3: 2.49 usec per loop

lisroach$ ./python.exe -m timeit "import json; json.dumps(1)"
2 loops, best of 5: 16.3 usec per loop

--

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



[issue36201] AssertCountEqual does not work for nested dictionaries.

2019-03-05 Thread Lisa Roach


Lisa Roach  added the comment:

I agree with Raymond, I think this might end up complicating things too much. 
It is common in the unit test library to only recurse one level deep and not 
assume too much about the intentions of the tester.

--

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



[issue35132] python-gdb error: Python Exception Type does not have a target

2019-02-13 Thread Lisa Roach


Change by Lisa Roach :


--
keywords: +patch
pull_requests: +11879
stage:  -> patch review

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



[issue35962] Slight error in words in [ 2.4.1. String and Bytes literals ]

2019-02-13 Thread Lisa Roach


Lisa Roach  added the comment:

The updated line sounds good to me, please make a PR.

--
nosy: +lisroach

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



[issue21150] Add quick links table to argparse docs

2019-02-13 Thread Lisa Roach


Lisa Roach  added the comment:

It looks like @louielu might not be around anymore to finish this PR? If there 
are no objections I'd like to give a new contributor @suhearsawho a shot at 
this.

--
nosy: +lisroach

___
Python tracker 
<https://bugs.python.org/issue21150>
___
___
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

2019-02-13 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 2bdd5858e3f89555c8de73a0f307d63536129dbd by Lisa Roach (Susan Su) 
in branch 'master':
bpo-35500: align expected and actual calls on mock.assert_called_with error 
message. (GH-11804)
https://github.com/python/cpython/commit/2bdd5858e3f89555c8de73a0f307d63536129dbd


--
nosy: +lisroach

___
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



[issue35132] python-gdb error: Python Exception Type does not have a target

2019-01-21 Thread Lisa Roach


Lisa Roach  added the comment:

I experienced this bug as well and have tried to dig into it a little. 

I experimented with a service I have that uses shared libraries. If I compile 
with high level of optimizations for the C++ code (-O3) I don't experience the 
issue, but compiling without any optimizations I do. 

I also tried with a script that does not use any shared libraries and I do not 
see the issue.


Digging into it a little, when running with the optimized version I found:

gdb.lookup_type('PyUnicodeObject')

returns a gdb.TYPE_CODE_TYPEDEF, which is the correct type. Running with the 
non-optimized version instead returns a gdb.TYPE_CODE_STRUCT.


The struct type errors because it has no target(), but I actually think 
target() might be superfluous here. 

Both versions if I only call `fields = 
gdb.lookup_type('PyUnicodeObject').fields()` returns a list of fields, one of 
which is named `data` for the purposes of the pep check, so target() doesn't 
seem vital.

--
nosy: +lisroach

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



[issue35656] More matchers in unittest.mock

2019-01-10 Thread Lisa Roach


Lisa Roach  added the comment:

APPROXIMATE feels like it might lead to code smell to me, if I know roughly 
what the float should be why would I not want to test it for exactness? It 
could end up hiding inconsistencies the tests should be catching.

--
nosy: +lisroach

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



[issue24209] Allow IPv6 bind in http.server

2018-11-26 Thread Lisa Roach


Change by Lisa Roach :


--
stage: patch review -> resolved

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



[issue24209] Allow IPv6 bind in http.server

2018-11-18 Thread Lisa Roach


Lisa Roach  added the comment:

Looks like the original author isn't around anymore (feel free to chime in if 
you are, Link!), so I went ahead and made a PR. I added a quick unit test, it's 
not much but more than nothing, plus updated the documentation.

--
nosy: +lisroach

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



[issue24209] Allow IPv6 bind in http.server

2018-11-18 Thread Lisa Roach


Change by Lisa Roach :


--
pull_requests: +9840
stage: test needed -> patch review

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



[issue35221] Enhance venv activate commands readability

2018-11-12 Thread Lisa Roach


Lisa Roach  added the comment:

Using plain angle brackets is common placeholder notation, and I think changing 
it to something different might be confusing to those who are familiar with the 
pattern. I have also seen plenty of people copying and pasting the wrong things 
because of this notation, but I agree with Steven that it is a part of the 
learning process that we all go through.

Perhaps just adding the line ' must be replaced by the path of the 
directory containing the virtual environment' would suffice to clarify?

--
nosy: +lisroach

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



[issue24412] setUpClass equivalent for addCleanup

2018-11-08 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 0f221d09cad46bee38d1b7a7822772df66c53028 by Lisa Roach in branch 
'master':
bpo-24412: Adds cleanUps for setUpClass and setUpModule. (GH-9190)
https://github.com/python/cpython/commit/0f221d09cad46bee38d1b7a7822772df66c53028


--
nosy: +lisroach

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



  1   2   >