facebook/TestSlide

AttributeError for asyncio.coroutines.CoroWrapper in Python 3.11.0

Closed this issue · 1 comments

I'm using TestSlide version: 2.7.0

Given:
A test with self.mock_callable() running on Python 3.11.0

When I run:
testslide -f p mytestfile.py

https://github.com/cricalix/pybaresip/actions/runs/3610512341/jobs/6084354800

I expected this to happen:

No AttributeError; mock_callable works.

But, instead this happened:

  1) baresip uanew, when the account does not start with sip: it adds a sip prefix and calls invoke
    1) AttributeError: module 'asyncio.coroutines' has no attribute 'CoroWrapper'
      File "tests/baresip_uanew.py", line 22, in before
        self.mock_callable(target=bs.logger, method="warning").to_return_value(None)

cpython changed in 2021 to remove the CoroWrapper class from the asyncio.coroutines module.
python/cpython@a1092f6#diff-9c7589fd86655ebc0075c014646c69ffc77d3f446a653ed09c69421c78d5803fL36

I suspect a simple try/except for _is_coroutine in mock_callable.py is sufficient to fix the problem (or do a conditional check of the version of Python?).

Ah, nevermind, it's fixed in main. It's just that there's been no release to pypi with a version bump for that fix. I'll just take Python 3.11 out of my test suite for now.