Open rndusr opened 4 years ago
Can you provide a stack trace?
Sure thing.
self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7f034d1a1490>
def __next__(self):
try:
with self._limited_patchings_stack():
> return self.gen.send(None)
E StopIteration
venv/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration
During handling of the above exception, another exception occurred:
venv/lib/python3.8/site-packages/asynctest/case.py:297: in run
self._run_test_method(testMethod)
venv/lib/python3.8/site-packages/asynctest/case.py:354: in _run_test_method
self.loop.run_until_complete(result)
venv/lib/python3.8/site-packages/asynctest/case.py:224: in wrapper
return method(*args, **kwargs)
/usr/lib/python3.8/asyncio/base_events.py:616: in run_until_complete
return future.result()
venv/lib/python3.8/site-packages/asynctest/mock.py:115: in wrapper
return await coroutine(*args, **kwargs)
venv/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__
self._stop_global_patchings()
venv/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings
if _is_started(patching):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
patching = <asynctest.mock._patch object at 0x7f034d2c60a0>
def _is_started(patching):
if isinstance(patching, _patch_dict):
return patching._is_started
else:
> return unittest.mock._is_started(patching)
E AttributeError: module 'unittest.mock' has no attribute '_is_started'
venv/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError
I can confirm this issue on Python 3.9.
When running the unittests there are multiple instances of this error - e.g.:
test_generator_arg_is_default_mock (test.Test_patch_decorator_coroutine_or_generator) ... ERROR
Exception ignored in: <function _PatchedGenerator.__del__ at 0xf6b8c9b8>
Traceback (most recent call last):
File "/builddir/build/BUILD/asynctest-0.13.0/asynctest/mock.py", line 1065, in __del__
self._stop_global_patchings()
File "/builddir/build/BUILD/asynctest-0.13.0/asynctest/mock.py", line 1032, in _stop_global_patchings
if _is_started(patching):
File "/builddir/build/BUILD/asynctest-0.13.0/asynctest/mock.py", line 124, in _is_started
return unittest.mock._is_started(patching)
See https://kojipkgs.fedoraproject.org//work/tasks/8916/45078916/build.log for details.
This log also contains a bunch of other errors.
btw work-around is switching unittest.IsolatedAsyncioTestCase
This happens with Python 3.8.3rc1.
I don't know how to reproduce this issue but it looks like asynctest is using a private function that is commented as "XXXX horrible" that was removed in this commit: https://github.com/python/cpython/commit/4b222c9491d1700e9bdd98e6889b8d0ea1c7321e