question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Asynctest owner suggests switch to asyncmock

See original GitHub issue

When using the asynctest package (which is a dependency of respx) with Python 3.8+, there are deprecation warnings:

.venv/lib/python3.8/site-packages/asynctest/mock.py:448
  /Users/.../.venv/lib/python3.8/site-packages/asynctest/mock.py:448: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    def wait_next(self, skip=0):

The author of asynctest suggests moving to asyncmock instead of resolving the issues (1, 2).

I am wondering if this would be an option for you to make respx future-proof.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lundbergcommented, Aug 17, 2020

Thanks for testing @hugovk , 0.12.0 now released.

1reaction
lundbergcommented, Aug 14, 2020

I’ve opened #69 . Since we’re only patching methods and not really using async magic mocks, I was able to drop the asynctest dependency completely.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mocking — asynctest 0.12.3 documentation
As the documentation of unittest says it, create_autospec() creates mock objects that have the same ... It doesn't change the outcome of the...
Read more >
Strategies for Testing Async Code in Python - Agari
Discover how to write tests for asyncio codebases in Python, with examples taken from real-world code in Agari Phishing Defense.
Read more >
Test and Mock Asynchronous Calls With the Jest Testing ...
This change ensures there will be one expect executed in this test case. Therefore, since no expect is called before exiting, the test...
Read more >
How to use the asynctest.mock.patch function in ... - Snyk
To help you get started, we've selected a few asynctest.mock.patch examples, based on popular ways it is used in public projects.
Read more >
Patching Async Object in Python 3.8 - Stack Overflow
For testing asyncio code by means of pytest I would suggest you to use libs pytest-asyncio and asynctest.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found