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
Change by Lisa Roach :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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/8374d2ee1589791be8892b00f4bbf8
Change by Lisa Roach :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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/i
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 sugg
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
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() f
Change by Lisa Roach :
--
keywords: +easy, newcomer friendly
___
Python tracker
<https://bugs.python.org/issue42038>
___
___
Python-bugs-list mailing list
Unsub
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/i
Change by Lisa Roach :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Lisa Roach added the comment:
PR merged, thanks Jason!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Lisa Roach :
--
pull_requests: +16796
pull_request: https://github.com/python/cpython/pull/17304
___
Python tracker
<https://bugs.python.org/issue38
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/cpyt
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/279d8df5e5e8bbd4429420649359f7
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/21f24ead90c22d0e2c2ebf14a64b37
Change by Lisa Roach :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Lisa Roach :
--
pull_requests: +16069
pull_request: https://github.com/python/cpython/pull/16484
___
Python tracker
<https://bugs.python.org/issue38
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/3667e1ee6c90e6d3b6a745cd590ece
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/36e7e4aabb662e86e9dace1a644749
Change by Lisa Roach :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Lisa Roach :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Lisa Roach :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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/b76ab352405df105c2d459fc66ef8d
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/25e115ec00b5f75e3589c9f21013c4
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/issu
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/9a7d9519506ae807ca48ff02e2ea11
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/issu
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
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/cpyt
Change by Lisa Roach :
--
pull_requests: +16010
pull_request: https://github.com/python/cpython/pull/16431
___
Python tracker
<https://bugs.python.org/issue38
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
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
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/ef048517755db1f0d211fb6dfc655a
Change by Lisa Roach :
--
pull_requests: +15885
pull_request: https://github.com/python/cpython/pull/16299
___
Python tracker
<https://bugs.python.org/issue38
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/8b03f943c37e07fb2394acdcfacd06
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()
>>&
Lisa Roach added the comment:
(y) Thanks for looking into it Stéphane!
--
___
Python tracker
<https://bugs.python.org/issue38100>
___
___
Python-bugs-list mailin
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/issu
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
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
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
Change by Lisa Roach :
--
nosy: +lisroach
___
Python tracker
<https://bugs.python.org/issue17013>
___
___
Python-bugs-list mailing list
Unsubscribe:
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/issu
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
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
re
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
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
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/issu
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
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
-
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
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)
keyw
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 c
Change by Lisa Roach :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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/f1a297acb60b88917712450ebd3cfa
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
Change by Lisa Roach :
--
pull_requests: +15476
pull_request: https://github.com/python/cpython/pull/15830
___
Python tracker
<https://bugs.python.org/issue37
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/b9f65f01fd761da7799f36d29b5451
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:
>
> FW
Lisa Roach added the comment:
Sounds good, thanks for the explanation Yury. I look forward to the TaskGroups!
--
___
Python tracker
<https://bugs.python.org/issue30
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_comp
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/issue38
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/issu
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 track
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/issue37
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/is
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.
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/issue37
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
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):
..
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
Change by Lisa Roach :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue24412>
___
___
Pyth
Lisa Roach added the comment:
Oops, didn't see your post. Thanks!
--
___
Python tracker
<https://bugs.python.org/issue36996>
___
___
Python-bugs-list m
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
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/i
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
-
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/issu
Change by Lisa Roach :
--
pull_requests: -13094
___
Python tracker
<https://bugs.python.org/issue36674>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Lisa Roach :
--
pull_requests: +13096
___
Python tracker
<https://bugs.python.org/issue36674>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Lisa Roach :
--
keywords: +patch
pull_requests: +13094
stage: test needed -> patch review
___
Python tracker
<https://bugs.python.org/issu
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
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/issue36
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
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/is
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
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/1ceb3a3d172dcf0ddff38d5d6b5594
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.dum
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
Change by Lisa Roach :
--
keywords: +patch
pull_requests: +11879
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue35132>
___
___
Py
Lisa Roach added the comment:
The updated line sounds good to me, please make a PR.
--
nosy: +lisroach
___
Python tracker
<https://bugs.python.org/issue35
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
&
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/cpyt
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 withou
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
Change by Lisa Roach :
--
stage: patch review -> resolved
___
Python tracker
<https://bugs.python.org/issue24209>
___
___
Python-bugs-list mailing list
Un
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:
Change by Lisa Roach :
--
pull_requests: +9840
stage: test needed -> patch review
___
Python tracker
<https://bugs.python.org/issue24209>
___
___
Python-
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
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
-
1 - 100 of 138 matches
Mail list logo