Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating with Python 3.8 #144

Open
Kentzo opened this issue Nov 12, 2019 · 7 comments
Open

Integrating with Python 3.8 #144

Kentzo opened this issue Nov 12, 2019 · 7 comments

Comments

@Kentzo
Copy link
Contributor

Kentzo commented Nov 12, 2019

CPython accepted a commit that basically copies subset of asynctest into the standard library.

Should we champion our cause there?

Pros:

  • No legacy: it's Python 3.8+ only
  • We can alter mock's internals for our needs
@dimaqq
Copy link

dimaqq commented Nov 13, 2019

@Kentzo would be nice state explicitly what "our cause" is :)

@Kentzo
Copy link
Contributor Author

Kentzo commented Nov 13, 2019

Full spectrum of features offered by asynctest of course :)

@Martiusweb
Copy link
Owner

Hi,

I discussed with Lisa Roach who contributed this to cPython. AsyncMock is actually borrowing code from CoroutineMock, which is great but makes it hard to make asynctest compatible with Python 3.8.

I'd be super happy to push more features from asynctest directly into cPython, in particular, an AsyncTestCase would probably be a nice addition.

I have yet to look in depth at what features have been introduced in unittest by AsyncMock and where it diverges from asynctest. Ideally, more and more features would be introduced in unittest, making asynctest progressively irrelevant and deprecated.

I've been slowly drafting a doc summarizing the changes I'd like to make to support Python 3.8:
https://docs.google.com/document/d/1w5QSXafNI7Xsswwbd56KFA6EEjCXgNMgmF_BwAgVsvE/edit

@Kentzo
Copy link
Contributor Author

Kentzo commented Nov 13, 2019

I have authored python/cpython#17133 yesterday which is essentially _AwaitedEvent for threads. If accepted it would allow to make another PR with _AwaitedEvent.

@dimaqq
Copy link

dimaqq commented Nov 14, 2019

Re:

users should be able to replace all references of “unittest” with “asynctest”

I, for one, mix and match unittest.mock and asynctest. A whole bunch of unit tests run synchronously and those that require asynchrony specifically because code under test await’s something “external” use asynctest...

@dimaqq
Copy link

dimaqq commented Nov 14, 2019

+1 on

deprecate asynctest.CoroutineMock

@dimaqq
Copy link

dimaqq commented Nov 14, 2019

Re: AsyncTestCase
I’m squarely in the rosy pytest world, so no opinion here ;) Perhaps core devs may be Interested in better way to write tests like e.g. https://github.com/python/cpython/blob/master/Lib/test/test_asyncio/test_futures.py

marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Jul 4, 2021
asynctest doesn't work with Python 3.8+, but AsyncMock() and few other
parts are available in the standard library already.

See Martiusweb/asynctest#144 and Martiusweb/asynctest#126
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Jul 4, 2021
asynctest doesn't work with Python 3.8+, but AsyncMock() and few other
parts are available in the standard library already.

See Martiusweb/asynctest#144 and Martiusweb/asynctest#126
marmarek added a commit to QubesOS/qubes-core-admin-client that referenced this issue Jul 4, 2021
asynctest doesn't work with Python 3.8+, but AsyncMock() and few other
parts are available in the standard library already.

See Martiusweb/asynctest#144 and Martiusweb/asynctest#126

(cherry picked from commit 1a2ce72)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants