Martiusweb / asynctest

Enhance the standard unittest package with features for testing asyncio libraries
https://asynctest.readthedocs.org/
Apache License 2.0
309 stars 41 forks source link

0.13.0: pytest is failing #160

Open kloczek opened 2 years ago

kloczek commented 2 years ago

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0 plugins: cov-3.0.0, httpbin-1.0.1, anyio-3.3.4 collected 231 items doc/examples/tutorial/test_cases.py .......F [ 3%] test/test_case.py .F.......................................... [ 22%] test/test_helpers.py ... [ 23%] test/test_mock.py .................................................................F..F.....................F.Exception ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' FFFException ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' Exception ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' FF.FException ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' F.F..Exception ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' FFFFF.FFFFFException ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' FFFException ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' FFFFException ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' Exception ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' FFException ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' Exception ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' FFFException ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' Exception ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' Exception ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' FFFFFFF.......FF... [ 87%] FFFFF. [ 89%] test/test_selector.py ...................F.... [100%] ================================================================================= FAILURES ================================================================================= ______________________________________________________ AnExempleWhichDetectsPendingCallbacks.test_missing_a_callback _______________________________________________________ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:300: in run self._tearDown() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:262: in _tearDown self._checker.check_test(self) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/_fail_on.py:90: in check_test getattr(self, check)(case) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/_fail_on.py:111: in active_handles case.fail("Loop contained unfinished work {!r}".format(handles)) E AssertionError: Loop contained unfinished work (,) _____________________________________________________________________ Test.LoggingTestCase.test_basic ______________________________________________________________________ self = , result = def run(self, result=None): orig_result = result if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) if startTestRun is not None: startTestRun() result.startTest(self) > testMethod = getattr(self, self._testMethodName) E AttributeError: 'LoggingTestCase' object has no attribute 'runTest' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:275: AttributeError ________________________________________________________ Test_CoroutineMock_awaited.test_awaited_from_autospec_mock ________________________________________________________ self = @asyncio.coroutine def test_awaited_from_autospec_mock(self): mock = asynctest.mock.create_autospec(Test) self.assertFalse(mock.a_coroutine.awaited) self.assertEqual(0, mock.a_coroutine.await_count) yield from mock.a_coroutine() self.assertTrue(mock.a_coroutine.awaited) > self.assertEqual(1, mock.a_coroutine.await_count) E AssertionError: 1 != 2 test/test_mock.py:577: AssertionError __________________________________________ Test_CoroutineMock_awaited.test_create_autospec_on_coroutine_and_using_assert_methods ___________________________________________ self = def test_create_autospec_on_coroutine_and_using_assert_methods(self): mock = asynctest.create_autospec(Test.a_coroutine_with_args) mock.assert_not_awaited() yield from mock("arg0", "arg1", "arg2") mock.assert_awaited() # calls assert not awaited > mock.assert_awaited_once() test/test_mock.py:778: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def assert_awaited_once(self): """ Assert that the mock was awaited exactly once. """ if not self.await_count == 1: msg = (f"Expected {self._mock_name or 'mock'} to have been awaited once." f" Awaited {self.await_count} times.") > raise AssertionError(msg) E AssertionError: Expected mock to have been awaited once. Awaited 2 times. /usr/lib64/python3.8/unittest/mock.py:2168: AssertionError ____________________________________________________ Test_patch.test_patch_is_enabled_when_running_decorated_coroutine _____________________________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc108f02940> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration: True ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_patch_is_enabled_when_running_decorated_coroutine(self): with self.subTest("old style coroutine"): @patch_is_patched() @asyncio.coroutine def a_coroutine(): import test.test_mock return test.test_mock.Test().is_patched() > self.assertTrue(run_coroutine(a_coroutine())) test/test_mock.py:975: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError ______________________________________________ Test_patch_decorator_coroutine_or_generator.test_coroutine_arg_is_default_mock ______________________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc1082e1400> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration: (True, True) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_coroutine_arg_is_default_mock(self): @asyncio.coroutine def tester(coroutine_function): loop = asyncio.get_event_loop() fut = asyncio.Future(loop=loop) loop.call_soon(fut.set_result, None) before, after = yield from coroutine_function(fut) self.assertTrue(before) self.assertTrue(after) def is_instance_of_mock(obj): return isinstance(obj, asynctest.mock.Mock) def is_same_mock(obj): import test.test_mock return obj is test.test_mock.Test with self.subTest("old style coroutine"): @asynctest.mock.patch('test.test_mock.Test') def a_coroutine(fut, mock): before = is_instance_of_mock(mock) yield from fut after = is_same_mock(mock) return before, after > run_coroutine(tester(a_coroutine)) test/test_mock.py:1066: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() test/test_mock.py:1047: in tester before, after = yield from coroutine_function(fut) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError _______________________________________________ Test_patch_decorator_coroutine_or_generator.test_coroutine_type_when_patched _______________________________________________ self = def test_coroutine_type_when_patched(self): with self.subTest("old style coroutine"): a_coroutine = Test.a_staticmethod_coroutine a_patched_coroutine = patch_is_patched()(a_coroutine) self.assertEqual(asyncio.iscoroutinefunction(a_patched_coroutine), asyncio.iscoroutinefunction(a_coroutine)) self.assertEqual(inspect.isgeneratorfunction(a_patched_coroutine), inspect.isgeneratorfunction(a_coroutine)) coro = a_coroutine() patched_coro = a_patched_coroutine() try: self.assertEqual(asyncio.iscoroutine(patched_coro), asyncio.iscoroutine(coro)) finally: > run_coroutine(coro) test/test_mock.py:1010: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:595: in run_until_complete future = tasks.ensure_future(future, loop=self) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coro_or_future = def ensure_future(coro_or_future, *, loop=None): """Wrap a coroutine or an awaitable in a future. If the argument is a Future, it is returned directly. """ if coroutines.iscoroutine(coro_or_future): if loop is None: loop = events.get_event_loop() task = loop.create_task(coro_or_future) if task._source_traceback: del task._source_traceback[-1] return task elif futures.isfuture(coro_or_future): if loop is not None and loop is not futures._get_loop(coro_or_future): raise ValueError('The future belongs to a different loop than ' 'the one specified as the loop argument') return coro_or_future elif inspect.isawaitable(coro_or_future): return ensure_future(_wrap_awaitable(coro_or_future), loop=loop) else: > raise TypeError('An asyncio.Future, a coroutine or an awaitable is ' 'required') E TypeError: An asyncio.Future, a coroutine or an awaitable is required /usr/lib64/python3.8/asyncio/tasks.py:684: TypeError ______________________________________________ Test_patch_decorator_coroutine_or_generator.test_generator_arg_is_default_mock ______________________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc108efd460> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_generator_arg_is_default_mock(self): @asynctest.mock.patch('test.test_mock.Test') def a_generator(mock): self.assertIsInstance(mock, asynctest.mock.Mock) yield import test.test_mock self.assertIs(mock, test.test_mock.Test) > for _ in a_generator(): test/test_mock.py:1038: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError ____________________________________________________ Test_patch_object.test_patch_coroutine_function_with_CoroutineMock ____________________________________________________ self = def test_patch_coroutine_function_with_CoroutineMock(self): with asynctest.mock.patch.object(Test(), 'a_coroutine') as mock: > self.assertIsInstance(mock, asynctest.mock.CoroutineMock) E AssertionError: is not an instance of test/test_mock.py:1091: AssertionError _____________________________________________________________ Test_patch_object.test_patch_decorates_coroutine _____________________________________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc108d91ca0> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration: True ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_patch_decorates_coroutine(self): obj = Test() with self.subTest("old style coroutine"): @asynctest.patch.object(obj, "is_patched", new=lambda: True) @asyncio.coroutine def a_coroutine(): return obj.is_patched() > self.assertTrue(run_coroutine(a_coroutine())) test/test_mock.py:1105: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError ___________________________________________________ Test_patch_multiple.test_patch_coroutine_function_with_CoroutineMock ___________________________________________________ self = def test_patch_coroutine_function_with_CoroutineMock(self): default = asynctest.mock.DEFAULT with asynctest.mock.patch.multiple('test.test_mock.Test', a_function=default, a_coroutine=default, an_async_coroutine=default): import test.test_mock obj = test.test_mock.Test() self.assertIsInstance(obj.a_function, asynctest.mock.MagicMock) > self.assertIsInstance(obj.a_coroutine, asynctest.mock.CoroutineMock) E AssertionError: is not an instance of test/test_mock.py:1132: AssertionError ____________________________________________________________ Test_patch_multiple.test_patch_decorates_coroutine ____________________________________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc108ec1d90> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration: True ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_patch_decorates_coroutine(self): with self.subTest("old style coroutine"): @asynctest.mock.patch.multiple("test.test_mock.Test", is_patched=lambda self: True) @asyncio.coroutine def a_coroutine(): import test.test_mock return test.test_mock.Test().is_patched() > self.assertTrue(run_coroutine(a_coroutine())) test/test_mock.py:1144: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError ________________________________________________________________ Test_patch_dict.test_patch_decorates_class ________________________________________________________________ self = def test_patch_decorates_class(self): import test.test_mock @patch_dict_is_patched() class Patched: @asyncio.coroutine def test_a_coroutine(self): return test.test_mock.Test().a_dict['is_patched'] def test_a_function(self): return test.test_mock.Test().a_dict['is_patched'] instance = Patched() > self.assertFalse(test.test_mock.Test().a_dict['is_patched']) E AssertionError: is not false test/test_mock.py:1196: AssertionError _______________________________________________________________ Test_patch_autospec.test_autospec_coroutine ________________________________________________________________ self = def test_autospec_coroutine(self): called = False @asynctest.mock.patch(self.test_class_path, autospec=True) def patched(mock): nonlocal called called = True self.assertIsInstance(mock.a_coroutine, asynctest.mock.CoroutineMock) self.assertIsInstance(mock().a_coroutine, asynctest.mock.CoroutineMock) self.assertIsInstance(mock.a_function, asynctest.mock.Mock) self.assertIsInstance(mock().a_function, asynctest.mock.Mock) self.assertIsInstance(mock.an_async_coroutine, asynctest.mock.CoroutineMock) self.assertIsInstance(mock().an_async_coroutine, asynctest.mock.CoroutineMock) > patched() test/test_mock.py:1224: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/unittest/mock.py:1325: in patched return func(*newargs, **newkeywargs) test/test_mock.py:1213: in patched self.assertIsInstance(mock.a_coroutine, E AssertionError: is not an instance of _______________________________________________________ Test_patch_autospec.test_patch_autospec_with_patches_on_top ________________________________________________________ self = def test_patch_autospec_with_patches_on_top(self): called = False @asynctest.mock.patch("{}.{}".format(self.test_class_path, "is_patched"), return_value=True) @asynctest.mock.patch("{}.{}".format(self.test_class_path, "a_coroutine"), autospec=True) def patched_function(coroutine_mock, is_patched_mock): nonlocal called called = True self.assertIsInstance(Test.is_patched, asynctest.mock.Mock) self.assertTrue(Test.is_patched()) self.assertTrue(asyncio.iscoroutinefunction(coroutine_mock)) self.assertTrue(asyncio.iscoroutinefunction(Test.a_coroutine)) > patched_function() test/test_mock.py:1243: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/unittest/mock.py:1325: in patched return func(*newargs, **newkeywargs) test/test_mock.py:1240: in patched_function self.assertTrue(asyncio.iscoroutinefunction(coroutine_mock)) E AssertionError: False is not true ________________________________________________________ Test_patch_autospec.test_patch_autospec_with_patches_under ________________________________________________________ self = def test_patch_autospec_with_patches_under(self): called = False @asynctest.mock.patch("{}.{}".format(self.test_class_path, "a_coroutine"), autospec=True) @asynctest.mock.patch("{}.{}".format(self.test_class_path, "is_patched"), return_value=True) def patched_function(is_patched_mock, coroutine_mock): nonlocal called called = True self.assertIsInstance(Test.is_patched, asynctest.mock.Mock) self.assertTrue(Test.is_patched()) self.assertTrue(asyncio.iscoroutinefunction(coroutine_mock)) self.assertTrue(asyncio.iscoroutinefunction(Test.a_coroutine)) > patched_function() test/test_mock.py:1262: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/unittest/mock.py:1325: in patched return func(*newargs, **newkeywargs) test/test_mock.py:1259: in patched_function self.assertTrue(asyncio.iscoroutinefunction(coroutine_mock)) E AssertionError: False is not true _____________________________________________________________ Test_patch_autospec.test_patch_multiple_autospec _____________________________________________________________ TypeError: An asyncio.Future, a coroutine or an awaitable is required During handling of the above exception, another exception occurred: self = def test_patch_multiple_autospec(self): called = False default = asynctest.mock.DEFAULT @asynctest.mock.patch.multiple(Test, autospec=True, a_coroutine=default, a_coroutine_with_args=default) def patched_function(**patched): nonlocal called called = True with self.assertRaisesRegex(TypeError, "arg2"): run_coroutine(Test().a_coroutine_with_args("arg")) test = Test() self.assertTrue(run_coroutine(test.a_coroutine())) self.assertTrue(run_coroutine(test.a_coroutine_with_args("arg", "arg2"))) > patched_function() test/test_mock.py:1300: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/unittest/mock.py:1325: in patched return func(*newargs, **newkeywargs) test/test_mock.py:1294: in patched_function run_coroutine(Test().a_coroutine_with_args("arg")) E AssertionError: "arg2" does not match "An asyncio.Future, a coroutine or an awaitable is required" ______________________________________________________________ Test_patch_autospec.test_patch_object_autospec ______________________________________________________________ self = def test_patch_object_autospec(self): called = False @asynctest.mock.patch.object(Test, "a_coroutine_with_args", autospec=True) def patched_function(patched): nonlocal called called = True self.assertTrue(asyncio.iscoroutinefunction(Test.a_coroutine_with_args)) with self.assertRaisesRegex(TypeError, "arg2"): run_coroutine(Test().a_coroutine_with_args("arg")) self.assertTrue(run_coroutine(Test().a_coroutine_with_args("arg", "arg2"))) > patched_function() test/test_mock.py:1279: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/unittest/mock.py:1325: in patched return func(*newargs, **newkeywargs) test/test_mock.py:1273: in patched_function self.assertTrue(asyncio.iscoroutinefunction(Test.a_coroutine_with_args)) E AssertionError: False is not true _____________________________________ Test_patch_dict_decorator_coroutine_or_generator_scope.test_patch_coroutine_with_multiple_scopes _____________________________________ self = def test_patch_coroutine_with_multiple_scopes(self): def tester(): return (self.is_patched(), self.second_dict_is_patched()) @asyncio.coroutine def tester_coroutine(future): before = tester() yield from future after = tester() return before, after def run_test(a_coroutine): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) try: future = asyncio.Future(loop=loop) task = loop.create_task(a_coroutine(future)) loop.call_soon(lambda: future.set_result(tester())) before, after = loop.run_until_complete(task) finally: loop.close() return before, future.result(), after with self.subTest("old style coroutine - Outer: GLOBAL, inner: LIMITED"): @patch_dict_is_patched(scope=asynctest.GLOBAL) @patch_dict_second_dict_is_patched(scope=asynctest.LIMITED) @asyncio.coroutine def a_coroutine(future): return (yield from tester_coroutine(future)) before, between, after = run_test(a_coroutine) > self.assertEqual((True, True), before) E AssertionError: Tuples differ: (True, True) != () E E First differing element 0: E True E E E - (True, True) E + (, E + ) test/test_mock.py:1518: AssertionError _____________________________________ Test_patch_dict_decorator_coroutine_or_generator_scope.test_patch_generator_with_multiple_scopes _____________________________________ self = def test_patch_generator_with_multiple_scopes(self): with self.subTest("Outer: GLOBAL, inner: LIMITED"): @patch_dict_is_patched(scope=asynctest.GLOBAL) @patch_dict_second_dict_is_patched(scope=asynctest.LIMITED) def a_generator(): yield (self.is_patched(), self.second_dict_is_patched()) yield (self.is_patched(), self.second_dict_is_patched()) gen = a_generator() try: > self.assertEqual((True, True), next(gen)) E AssertionError: Tuples differ: (True, True) != () E E First differing element 0: E True E E E - (True, True) E + (, E + ) test/test_mock.py:1418: AssertionError ______________________________ Test_patch_dict_decorator_coroutine_or_generator_scope.test_patch_generator_with_multiple_scopes_on_same_dict _______________________________ self = def test_patch_generator_with_multiple_scopes_on_same_dict(self): import test.test_mock def tester(): test.test_mock.Test.a_dict['overriden_value'] = True for _ in range(2): yield ( self.is_patched(), self.second_is_patched(), test.test_mock.Test.a_dict.get('overriden_value', False)) with self.subTest("Outer: GLOBAL, inner: LIMITED"): @patch_dict_is_patched(scope=asynctest.GLOBAL) @patch_dict_second_is_patched(scope=asynctest.LIMITED) def a_generator(): yield from tester() gen = a_generator() try: > self.assertEqual((True, True, True), next(gen)) E AssertionError: Tuples differ: (True, True, True) != () E E First differing element 0: E True E E E - (True, True, True) E + (, E + , E + ) test/test_mock.py:1461: AssertionError ________________________________________________ Test_patch_dict_decorator_coroutine_or_generator_scope.test_scope_limited _________________________________________________ self = def test_scope_limited(self): @patch_dict_is_patched(scope=asynctest.LIMITED) def a_generator(): yield self.is_patched() yield self.is_patched() gen = a_generator() self.addCleanup(gen.close) self.assertTrue(next(gen)) > self.assertFalse(self.is_patched()) E AssertionError: is not false test/test_mock.py:1405: AssertionError _____________________________________________ Test_patch_and_patch_dict_scope.test_both_patch_and_patch_dict_with_scope_global _____________________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc108f43580> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration: (True, ) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_both_patch_and_patch_dict_with_scope_global(self): def test_result(): import test.test_mock instance = test.test_mock.Test() return (instance.is_patched(), instance.a_dict['is_patched']) with self.subTest("patch and patch.dict"): @patch_dict_is_patched(scope=asynctest.GLOBAL) @patch_is_patched(scope=asynctest.GLOBAL) @asyncio.coroutine def a_coroutine(): return test_result() > self.assertEqual((True, True), run_coroutine(a_coroutine())) test/test_mock.py:1577: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError ____________________________________________ Test_patch_and_patch_dict_scope.test_both_patch_and_patch_dict_with_scope_limited _____________________________________________ self = def test_both_patch_and_patch_dict_with_scope_limited(self): import test.test_mock instance = test.test_mock.Test() def test_result(instance): yield (instance.is_patched(), instance.a_dict['is_patched']) yield (instance.is_patched(), instance.a_dict['is_patched']) with self.subTest("patch and patch.dict"): @patch_dict_is_patched(scope=asynctest.LIMITED) @patch_is_patched(scope=asynctest.LIMITED) def a_generator(instance): yield from test_result(instance) gen = a_generator(instance) > self.assertEqual((True, True), next(gen)) test/test_mock.py:1603: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:985: in patched_factory patching.__exit__(*exc_info) /usr/lib64/python3.8/unittest/mock.py:1524: in __exit__ return exit_stack.__exit__(*exc_info) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , exc_details = () def __exit__(self, *exc_details): > received_exc = exc_details[0] is not None E IndexError: tuple index out of range /usr/lib64/python3.8/contextlib.py:483: IndexError ______________________________________________ Test_patch_decorator_coroutine_or_generator_scope.test_default_scope_is_global ______________________________________________ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1060: in close self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError _______________________________________ Test_patch_decorator_coroutine_or_generator_scope.test_patch_coroutine_with_multiple_scopes ________________________________________ self = def test_patch_coroutine_with_multiple_scopes(self): def set_fut_result(fut): fut.set_result((self.is_patched(), self.second_is_patched())) @asyncio.coroutine def tester(coro_function): loop = asyncio.get_event_loop() fut = asyncio.Future(loop=loop) loop.call_soon(set_fut_result, fut) before, after = yield from coro_function(fut) self.assertEqual((True, True), before) self.assertEqual((True, False), fut.result()) self.assertEqual((True, True), after) self.assertFalse(self.is_patched()) self.assertFalse(self.second_is_patched()) with self.subTest("old style coroutine - Outer: GLOBAL, inner: LIMITED"): @patch_is_patched(scope=asynctest.GLOBAL) @patch_second_is_patched(scope=asynctest.LIMITED) def a_coroutine(fut): before = (self.is_patched(), self.second_is_patched()) yield from fut after = (self.is_patched(), self.second_is_patched()) return before, after > run_coroutine(tester(a_coroutine)) test/test_mock.py:1697: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() test/test_mock.py:1681: in tester before, after = yield from coro_function(fut) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:985: in patched_factory patching.__exit__(*exc_info) /usr/lib64/python3.8/unittest/mock.py:1524: in __exit__ return exit_stack.__exit__(*exc_info) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , exc_details = () def __exit__(self, *exc_details): > received_exc = exc_details[0] is not None E IndexError: tuple index out of range /usr/lib64/python3.8/contextlib.py:483: IndexError _______________________________________ Test_patch_decorator_coroutine_or_generator_scope.test_patch_generator_with_multiple_scopes ________________________________________ self = def test_patch_generator_with_multiple_scopes(self): def a_generator(): yield (self.is_patched(), self.second_is_patched()) yield (self.is_patched(), self.second_is_patched()) with self.subTest("Outer: GLOBAL, inner: LIMITED"): @patch_is_patched(scope=asynctest.GLOBAL) @patch_second_is_patched(scope=asynctest.LIMITED) def patched(): yield from a_generator() gen = patched() try: > self.assertEqual((True, True), next(gen)) test/test_mock.py:1650: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:985: in patched_factory patching.__exit__(*exc_info) /usr/lib64/python3.8/unittest/mock.py:1524: in __exit__ return exit_stack.__exit__(*exc_info) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , exc_details = () def __exit__(self, *exc_details): > received_exc = exc_details[0] is not None E IndexError: tuple index out of range /usr/lib64/python3.8/contextlib.py:483: IndexError _________________________________ Test_patch_decorator_coroutine_or_generator_scope_GLOBAL.test_deactivate_patch_when_generator_exec_fails _________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc103ae6a60> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (), kw = {} @functools.wraps(func) def coro(*args, **kw): > res = func(*args, **kw) E TypeError: a_coroutine() missing 1 required positional argument: 'missing_arg' /usr/lib64/python3.8/asyncio/coroutines.py:124: TypeError During handling of the above exception, another exception occurred: self = def test_deactivate_patch_when_generator_exec_fails(self): > self._test_deactivate_patch_when_generator_exec_fails(asynctest.GLOBAL) test/test_mock.py:1739: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/test_mock.py:1348: in _test_deactivate_patch_when_generator_exec_fails run_coroutine(tester()) test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() test/test_mock.py:1341: in tester yield from a_coroutine() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError _________________________________ Test_patch_decorator_coroutine_or_generator_scope_GLOBAL.test_deactivate_patch_when_generator_init_fails _________________________________ args = (), kwargs = {}, extra_args = [], patchers_to_exit = [], patch_dict_with_limited_scope = [], exc_info = () patching = , arg = at 0x7fc108e2e700> def patched_factory(*args, **kwargs): extra_args = [] patchers_to_exit = [] patch_dict_with_limited_scope = [] exc_info = tuple() try: for patching in patchings: arg = patching.__enter__() if patching.scope == LIMITED: patchers_to_exit.append(patching) if isinstance(patching, _patch_dict): if patching.scope == GLOBAL: for limited_patching in patch_dict_with_limited_scope: if limited_patching.in_dict is patching.in_dict: limited_patching._keep_global_patch(patching) else: patch_dict_with_limited_scope.append(patching) else: if patching.attribute_name is not None: kwargs.update(arg) if patching.new is DEFAULT: patching.new = arg[patching.attribute_name] elif patching.new is DEFAULT: patching.mock_to_reuse = arg extra_args.append(arg) args += tuple(extra_args) > gen = func(*args, **kwargs) E TypeError: a_generator() missing 1 required positional argument: 'wrong_number_of_args' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:971: TypeError During handling of the above exception, another exception occurred: self = def test_deactivate_patch_when_generator_init_fails(self): > self._test_deactivate_patch_when_generator_init_fails(asynctest.GLOBAL) test/test_mock.py:1736: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/test_mock.py:1324: in _test_deactivate_patch_when_generator_init_fails next(gen) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:975: in patched_factory if patching not in patchers_to_exit and _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError _______________________________________ Test_patch_decorator_coroutine_or_generator_scope_GLOBAL.test_multiple_patches_on_coroutine ________________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc108c4aaf0> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration: ((True, ), (True, )) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_multiple_patches_on_coroutine(self): def set_fut_result(fut): fut.set_result((self.is_patched(), self.second_is_patched())) @asyncio.coroutine def tester(coro_function): loop = asyncio.get_event_loop() fut = asyncio.Future(loop=loop) loop.call_soon(set_fut_result, fut) before, after = yield from coro_function(fut) self.assertEqual((True, True), before) self.assertEqual((True, True), fut.result()) self.assertEqual((True, True), after) self.assertFalse(self.is_patched()) self.assertFalse(self.second_is_patched()) with self.subTest("old style coroutine"): @patch_second_is_patched(scope=asynctest.GLOBAL) @patch_is_patched(scope=asynctest.GLOBAL) def a_coroutine(fut): before = (self.is_patched(), self.second_is_patched()) yield from fut after = (self.is_patched(), self.second_is_patched()) return before, after > run_coroutine(tester(a_coroutine)) test/test_mock.py:1890: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() test/test_mock.py:1874: in tester before, after = yield from coro_function(fut) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError _______________________________________ Test_patch_decorator_coroutine_or_generator_scope_GLOBAL.test_multiple_patches_on_generator ________________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc1083b5340> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_multiple_patches_on_generator(self): @patch_second_is_patched(scope=asynctest.GLOBAL) @patch_is_patched(scope=asynctest.GLOBAL) def a_generator(): yield self.is_patched() and self.second_is_patched() yield self.is_patched() and self.second_is_patched() gen = a_generator() self.assertTrue(next(gen)) self.assertTrue(self.is_patched()) self.assertTrue(self.second_is_patched()) self.assertTrue(next(gen)) # exhaust the generator try: > next(gen) test/test_mock.py:1858: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError ____________________________________ Test_patch_decorator_coroutine_or_generator_scope_GLOBAL.test_patch_coroutine_during_its_lifetime _____________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc108211f40> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration: (True, True) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_patch_coroutine_during_its_lifetime(self): def set_fut_result(fut): fut.set_result(self.is_patched()) @asyncio.coroutine def tester(coro_function): loop = asyncio.get_event_loop() fut = asyncio.Future(loop=loop) loop.call_soon(set_fut_result, fut) before, after = yield from coro_function(fut) self.assertTrue(before) self.assertTrue(fut.result()) self.assertTrue(after) self.assertFalse(self.is_patched()) with self.subTest("old style coroutine"): @patch_is_patched(scope=asynctest.GLOBAL) def a_coroutine(fut): before = self.is_patched() yield from fut after = self.is_patched() return before, after > run_coroutine(tester(a_coroutine)) test/test_mock.py:1806: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() test/test_mock.py:1792: in tester before, after = yield from coro_function(fut) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError ______________________________________ Test_patch_decorator_coroutine_or_generator_scope_GLOBAL.test_patch_generator_during_its_close ______________________________________ self = def test_patch_generator_during_its_close(self): when_generator_closes = (False, False) @patch_second_is_patched(scope=asynctest.LIMITED) @patch_is_patched(scope=asynctest.GLOBAL) def a_generator(): try: while True: yield (self.is_patched(), self.second_is_patched()) except GeneratorExit: nonlocal when_generator_closes when_generator_closes = (self.is_patched(), self.second_is_patched()) raise gen = a_generator() > self.assertEqual((True, True), next(gen)) test/test_mock.py:1775: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:985: in patched_factory patching.__exit__(*exc_info) /usr/lib64/python3.8/unittest/mock.py:1524: in __exit__ return exit_stack.__exit__(*exc_info) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , exc_details = () def __exit__(self, *exc_details): > received_exc = exc_details[0] is not None E IndexError: tuple index out of range /usr/lib64/python3.8/contextlib.py:483: IndexError ____________________________________ Test_patch_decorator_coroutine_or_generator_scope_GLOBAL.test_patch_generator_during_its_lifetime _____________________________________ self = <[AttributeError("'_PatchedGenerator' object has no attribute 'generator'") raised in repr()] _PatchedGenerator object at 0x7fc103d3c190> def __next__(self): try: with self._limited_patchings_stack(): > return self.gen.send(None) E StopIteration ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1041: StopIteration During handling of the above exception, another exception occurred: self = def test_patch_generator_during_its_lifetime(self): @patch_is_patched(scope=asynctest.GLOBAL) def a_generator(): yield self.is_patched() yield self.is_patched() gen = a_generator() self.assertTrue(next(gen)) self.assertTrue(self.is_patched()) self.assertTrue(next(gen)) # exhaust the generator try: > next(gen) test/test_mock.py:1753: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1044: in __next__ self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError ___________________________________ Test_patch_decorator_coroutine_or_generator_scope_GLOBAL.test_patch_stopped_when_generator_is_closed ___________________________________ self = def test_patch_stopped_when_generator_is_closed(self): @patch_is_patched(scope=asynctest.GLOBAL) def a_generator(): yield self.is_patched() gen = a_generator() self.assertTrue(next(gen)) self.assertTrue(self.is_patched()) > gen.close() test/test_mock.py:1841: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1060: in close self._stop_global_patchings() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1032: in _stop_global_patchings if _is_started(patching): _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ patching = 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' ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:124: AttributeError _________________________________ Test_patch_decorator_coroutine_or_generator_scope_GLOBAL.test_patch_stopped_when_generator_is_collected __________________________________ self = @unittest.skipIf(platform.python_implementation() != "CPython", "Test relying on how __del__ is called by implementation") def test_patch_stopped_when_generator_is_collected(self): @patch_is_patched(scope=asynctest.GLOBAL) def a_generator(): yield self.is_patched() gen = a_generator() self.assertTrue(next(gen)) self.assertTrue(self.is_patched()) del gen > self.assertFalse(self.is_patched()) E AssertionError: True is not false test/test_mock.py:1831: AssertionError ________________________________ Test_patch_decorator_coroutine_or_generator_scope_LIMITED.test_deactivate_patch_when_generator_exec_fails _________________________________ self = def test_deactivate_patch_when_generator_exec_fails(self): > self._test_deactivate_patch_when_generator_exec_fails(asynctest.LIMITED) test/test_mock.py:1910: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/test_mock.py:1348: in _test_deactivate_patch_when_generator_exec_fails run_coroutine(tester()) test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() test/test_mock.py:1341: in tester yield from a_coroutine() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:985: in patched_factory patching.__exit__(*exc_info) /usr/lib64/python3.8/unittest/mock.py:1524: in __exit__ return exit_stack.__exit__(*exc_info) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , exc_details = () def __exit__(self, *exc_details): > received_exc = exc_details[0] is not None E IndexError: tuple index out of range /usr/lib64/python3.8/contextlib.py:483: IndexError ________________________________ Test_patch_decorator_coroutine_or_generator_scope_LIMITED.test_deactivate_patch_when_generator_init_fails _________________________________ self = def test_deactivate_patch_when_generator_init_fails(self): > self._test_deactivate_patch_when_generator_init_fails(asynctest.LIMITED) test/test_mock.py:1907: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/test_mock.py:1329: in _test_deactivate_patch_when_generator_init_fails self.assertFalse(self.is_patched()) E AssertionError: True is not false _______________________________________ Test_patch_decorator_coroutine_or_generator_scope_LIMITED.test_multiple_patches_on_coroutine _______________________________________ self = def test_multiple_patches_on_coroutine(self): def set_fut_result(fut): fut.set_result((self.is_patched(), self.second_is_patched())) @asyncio.coroutine def tester(coro_function): loop = asyncio.get_event_loop() fut = asyncio.Future(loop=loop) loop.call_soon(set_fut_result, fut) before, after = yield from coro_function(fut) self.assertEqual((True, True), before) self.assertEqual((False, False), fut.result()) self.assertEqual((True, True), after) self.assertFalse(self.is_patched()) self.assertFalse(self.second_is_patched()) with self.subTest("old style coroutine"): @patch_second_is_patched(scope=asynctest.LIMITED) @patch_is_patched(scope=asynctest.LIMITED) def a_coroutine(fut): before = (self.is_patched(), self.second_is_patched()) yield from fut after = (self.is_patched(), self.second_is_patched()) return before, after > run_coroutine(tester(a_coroutine)) test/test_mock.py:1996: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() test/test_mock.py:1980: in tester before, after = yield from coro_function(fut) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:985: in patched_factory patching.__exit__(*exc_info) /usr/lib64/python3.8/unittest/mock.py:1524: in __exit__ return exit_stack.__exit__(*exc_info) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , exc_details = () def __exit__(self, *exc_details): > received_exc = exc_details[0] is not None E IndexError: tuple index out of range /usr/lib64/python3.8/contextlib.py:483: IndexError _____________________________________ Test_patch_decorator_coroutine_or_generator_scope_LIMITED.test_patch_coroutine_only_when_running _____________________________________ self = def test_patch_coroutine_only_when_running(self): def set_fut_result(fut): fut.set_result(self.is_patched()) @asyncio.coroutine def tester(coro_function): loop = asyncio.get_event_loop() fut = asyncio.Future(loop=loop) loop.call_soon(set_fut_result, fut) before, after = yield from coro_function(fut) self.assertTrue(before) self.assertFalse(fut.result()) self.assertTrue(after) with self.subTest("old style coroutine"): @patch_is_patched(scope=asynctest.LIMITED) def a_coroutine(fut): before = self.is_patched() yield from fut after = self.is_patched() return before, after > run_coroutine(tester(a_coroutine)) test/test_mock.py:1945: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() test/test_mock.py:1932: in tester before, after = yield from coro_function(fut) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:985: in patched_factory patching.__exit__(*exc_info) /usr/lib64/python3.8/unittest/mock.py:1524: in __exit__ return exit_stack.__exit__(*exc_info) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , exc_details = () def __exit__(self, *exc_details): > received_exc = exc_details[0] is not None E IndexError: tuple index out of range /usr/lib64/python3.8/contextlib.py:483: IndexError _____________________________________ Test_patch_decorator_coroutine_or_generator_scope_LIMITED.test_patch_generator_only_when_running _____________________________________ self = def test_patch_generator_only_when_running(self): @patch_is_patched(scope=asynctest.LIMITED) def a_generator(): yield self.is_patched() yield self.is_patched() gen = a_generator() > self.assertTrue(next(gen)) test/test_mock.py:1919: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:985: in patched_factory patching.__exit__(*exc_info) /usr/lib64/python3.8/unittest/mock.py:1524: in __exit__ return exit_stack.__exit__(*exc_info) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , exc_details = () def __exit__(self, *exc_details): > received_exc = exc_details[0] is not None E IndexError: tuple index out of range /usr/lib64/python3.8/contextlib.py:483: IndexError _____________________________________ Test_patch_decorator_coroutine_or_generator_scope_LIMITED.test_patched_coroutine_with_mock_args ______________________________________ self = def test_patched_coroutine_with_mock_args(self): @asynctest.mock.patch('test.test_mock.Test', side_effect=lambda: None, scope=asynctest.LIMITED) @asyncio.coroutine def a_coroutine(mock): loop = asyncio.get_event_loop() self.assertIs(mock, Test) yield from asyncio.sleep(0, loop=loop) self.assertIs(mock, Test) yield from asyncio.sleep(0, loop=loop) self.assertIs(mock, Test) > run_coroutine(a_coroutine()) test/test_mock.py:1969: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete return future.result() ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:995: in patched_generator return (yield from patched_factory(*args, **kwargs)) ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:985: in patched_factory patching.__exit__(*exc_info) /usr/lib64/python3.8/unittest/mock.py:1524: in __exit__ return exit_stack.__exit__(*exc_info) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , exc_details = () def __exit__(self, *exc_details): > received_exc = exc_details[0] is not None E IndexError: tuple index out of range /usr/lib64/python3.8/contextlib.py:483: IndexError _________________________________________________ Test_create_autospec.test_autospec_attributes_being_coroutine_functions __________________________________________________ self = def test_autospec_attributes_being_coroutine_functions(self): mock = asynctest.mock.create_autospec(Test) self.assertFalse(asyncio.iscoroutinefunction(mock)) self.assertFalse(asyncio.iscoroutinefunction(mock.a_function)) > self.assertTrue(asyncio.iscoroutinefunction(mock.a_coroutine)) E AssertionError: False is not true test/test_mock.py:2136: AssertionError ______________________________________________ Test_create_autospec.test_autospec_of_coroutine_function_is_coroutinefunction _______________________________________________ self = def test_autospec_of_coroutine_function_is_coroutinefunction(self): mock = asynctest.mock.create_autospec(Test.a_function) self.assertFalse(asyncio.iscoroutinefunction(mock)) mock = asynctest.mock.create_autospec(Test.a_coroutine) > self.assertTrue(asyncio.iscoroutinefunction(mock)) E AssertionError: False is not true test/test_mock.py:2115: AssertionError _________________________________________ Test_create_autospec.test_create_autospec_on_coroutine_with_instance_raises_RuntimeError _________________________________________ self = def test_create_autospec_on_coroutine_with_instance_raises_RuntimeError(self): with self.assertRaises(RuntimeError): > asynctest.mock.create_autospec(Test.a_coroutine, instance=True) E AssertionError: RuntimeError not raised test/test_mock.py:2180: AssertionError _____________________________________________ Test_create_autospec.test_create_autospec_on_coroutine_with_iterable_side_effect _____________________________________________ self = def test_create_autospec_on_coroutine_with_iterable_side_effect(self): coroutines = [Test.a_coroutine, Test.an_async_coroutine] for a_coroutine in coroutines: mock = asynctest.mock.create_autospec( a_coroutine, side_effect=("PROBE1", "PROBE2")) > self.assertEqual("PROBE1", run_coroutine(mock(None))) test/test_mock.py:2158: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:595: in run_until_complete future = tasks.ensure_future(future, loop=self) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coro_or_future = 'PROBE1' def ensure_future(coro_or_future, *, loop=None): """Wrap a coroutine or an awaitable in a future. If the argument is a Future, it is returned directly. """ if coroutines.iscoroutine(coro_or_future): if loop is None: loop = events.get_event_loop() task = loop.create_task(coro_or_future) if task._source_traceback: del task._source_traceback[-1] return task elif futures.isfuture(coro_or_future): if loop is not None and loop is not futures._get_loop(coro_or_future): raise ValueError('The future belongs to a different loop than ' 'the one specified as the loop argument') return coro_or_future elif inspect.isawaitable(coro_or_future): return ensure_future(_wrap_awaitable(coro_or_future), loop=loop) else: > raise TypeError('An asyncio.Future, a coroutine or an awaitable is ' 'required') E TypeError: An asyncio.Future, a coroutine or an awaitable is required /usr/lib64/python3.8/asyncio/tasks.py:684: TypeError _________________________________________________ Test_create_autospec.test_create_autospec_on_coroutine_with_return_value _________________________________________________ self = def test_create_autospec_on_coroutine_with_return_value(self): mock = asynctest.mock.create_autospec(Test.a_coroutine, return_value="PROBE") > self.assertEqual("PROBE", run_coroutine(mock(None))) test/test_mock.py:2146: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test/utils.py:9: in run_coroutine return loop.run_until_complete(coroutine) /usr/lib64/python3.8/asyncio/base_events.py:595: in run_until_complete future = tasks.ensure_future(future, loop=self) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ coro_or_future = 'PROBE' def ensure_future(coro_or_future, *, loop=None): """Wrap a coroutine or an awaitable in a future. If the argument is a Future, it is returned directly. """ if coroutines.iscoroutine(coro_or_future): if loop is None: loop = events.get_event_loop() task = loop.create_task(coro_or_future) if task._source_traceback: del task._source_traceback[-1] return task elif futures.isfuture(coro_or_future): if loop is not None and loop is not futures._get_loop(coro_or_future): raise ValueError('The future belongs to a different loop than ' 'the one specified as the loop argument') return coro_or_future elif inspect.isawaitable(coro_or_future): return ensure_future(_wrap_awaitable(coro_or_future), loop=loop) else: > raise TypeError('An asyncio.Future, a coroutine or an awaitable is ' 'required') E TypeError: An asyncio.Future, a coroutine or an awaitable is required /usr/lib64/python3.8/asyncio/tasks.py:684: TypeError ______________________________________________ Test_create_autospec.test_generator_and_coroutine_is_instance_of_FunctionType _______________________________________________ self = def test_generator_and_coroutine_is_instance_of_FunctionType(self): # this test is somewhat a forward compatibility test: if ever # unittest.mock.FunctionTypes doesn't detect generators and coroutines # as instance of these types, we need to fix it in asynctest. def gen(): yield from range(10) self.assertIsInstance(gen, unittest.mock.FunctionTypes) > self.assertIsInstance(Test.a_coroutine, unittest.mock.FunctionTypes) E AssertionError: is not an instance of (, ) test/test_mock.py:2069: AssertionError __________________________________________________ Test_create_autospec.test_mock_add_spec_on_mock_created_with_autospec ___________________________________________________ self = def test_mock_add_spec_on_mock_created_with_autospec(self): # See bug #107 mock = asynctest.mock.create_autospec(Test()) self.assertFalse(hasattr(mock, "added_attribute")) mock.mock_add_spec(["added_attribute"]) > self.assertIsInstance(mock.added_attribute, asynctest.Mock) test/test_mock.py:2188: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , name = 'added_attribute' def __getattr__(self, name): if name in {'_mock_methods', '_mock_unsafe'}: raise AttributeError(name) elif self._mock_methods is not None: if name not in self._mock_methods or name in _all_magics: > raise AttributeError("Mock object has no attribute %r" % name) E AttributeError: Mock object has no attribute 'added_attribute' /usr/lib64/python3.8/unittest/mock.py:637: AttributeError ___________________________________________ Test_fail_on_active_selector_callbacks.test_events_watched_outside_test_are_ignored ____________________________________________ self = <_UnixSelectorEventLoop running=False closed=True debug=False>, fd = callback = . at 0x7fc1082311f0>, args = () handle = .() at /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_selector.py:295> def _add_reader(self, fd, callback, *args): self._check_closed() handle = events.Handle(callback, args, self, None) try: > key = self._selector.get_key(fd) /usr/lib64/python3.8/asyncio/selector_events.py:261: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , fileobj = def get_key(self, fileobj): """Return the key associated to a registered file object. Returns: SelectorKey for this file object """ mapping = self.get_map() if mapping is None: raise RuntimeError('Selector is closed') try: return mapping[fileobj] except KeyError: > raise KeyError("{!r} is not registered".format(fileobj)) from None E KeyError: " is not registered" /usr/lib64/python3.8/selectors.py:192: KeyError During handling of the above exception, another exception occurred: self = def test_events_watched_outside_test_are_ignored(self): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) try: mock = asynctest.selector.FileMock() > loop.add_reader(mock, lambda: None) test/test_selector.py:295: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/asyncio/selector_events.py:334: in add_reader return self._add_reader(fd, callback, *args) /usr/lib64/python3.8/asyncio/selector_events.py:263: in _add_reader self._selector.register(fd, selectors.EVENT_READ, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , fileobj = , events = 1 data = (.() at /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_selector.py:295>, None) def register(self, fileobj, events, data=None): key = super().register(fileobj, events, data) poller_events = 0 if events & EVENT_READ: poller_events |= self._EVENT_READ if events & EVENT_WRITE: poller_events |= self._EVENT_WRITE try: > self._selector.register(key.fd, poller_events) E PermissionError: [Errno 1] Operation not permitted /usr/lib64/python3.8/selectors.py:359: PermissionError ============================================================================= warnings summary ============================================================================= ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:434 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:434: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def wait(self, skip=0): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:448 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/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): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:468 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:468: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def wait_for(self, predicate): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:489 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:489: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def _notify(self): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:357 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:357: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def doCleanups(self): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:381 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:381: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def assertAsyncRaises(self, exception, awaitable): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:392 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:392: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def assertAsyncRaisesRegex(self, exception, regex, awaitable): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:403 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:403: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def assertAsyncWarns(self, warning, awaitable): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:414 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:414: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def assertAsyncWarnsRegex(self, warning, regex, awaitable): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:445 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:445: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def advance(self, seconds): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:487 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/case.py:487: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def _drain_loop(self): ../../BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/helpers.py:13 /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/helpers.py:13: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def exhaust_callbacks(loop): test/test_case.py:44 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:44: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def start_wait_process(loop): test/test_case.py:58 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:58: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def runTest(self): test/test_case.py:399 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:399: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def advance(self, seconds): test/test_case.py:412 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:412: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_advance(self): test/test_case.py:445 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:445: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_negative_advance(self): test/test_case.py:451 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:451: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_callbacks_are_called_on_time(self): test/test_case.py:477 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:477: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_setUp(self): test/test_case.py:484 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:484: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def setUp(self): test/test_case.py:494 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:494: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_setUp(self): test/test_case.py:876 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:876: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assertAsyncRaises(self): test/test_case.py:887 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:887: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assertAsyncRaisesRegex(self): test/test_case.py:905 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:905: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def warns(cls): test/test_case.py:916 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:916: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assertAsyncWarns(self): test/test_case.py:926 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:926: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assertAsyncWarnsRegex(self): test/test_helpers.py:11 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_helpers.py:11: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def wait_for(self, coro): test/test_mock.py:19 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:19: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine(self): test/test_mock.py:35 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:35: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine_with_args(self, arg, arg2): test/test_mock.py:40 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:40: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_classmethod_coroutine(cls): test/test_mock.py:45 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:45: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_staticmethod_coroutine(): test/test_mock.py:522 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:522: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_awaited_CoroutineMock_sets_awaited(self): test/test_mock.py:540 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:540: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_awaited_CoroutineMock_counts(self): test/test_mock.py:569 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:569: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_awaited_from_autospec_mock(self): test/test_mock.py:580 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:580: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_awaited_wait(self): test/test_mock.py:595 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:595: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_awaited_wait_next(self): test/test_mock.py:614 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:614: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_await_args(self): test/test_mock.py:632 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:632: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_await_args_list(self): test/test_mock.py:650 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:650: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assert_awaited(self): test/test_mock.py:660 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:660: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assert_awaited_once(self): test/test_mock.py:674 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:674: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assert_awaited_with(self): test/test_mock.py:688 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:688: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assert_awaited_once_with(self): test/test_mock.py:702 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:702: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assert_any_wait(self): test/test_mock.py:719 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:719: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assert_has_awaits(self): test/test_mock.py:763 /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:763: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_assert_not_awaited(self): test/test_case.py::Test::StartWaitProcessTestCase::runTest test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_watched_process_is_awaited test/test_case.py::Test_TestCase_and_ChildWatcher::test_watched_process_is_awaited /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:45: DeprecationWarning: The loop argument is deprecated since Python 3.8 and scheduled for removal in Python 3.10. process = yield from asyncio.create_subprocess_shell( test/test_case.py::Test::StartWaitProcessTestCase::runTest test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_original_watcher_works_outside_loop test/test_case.py::Test_TestCase_and_ChildWatcher::test_watched_process_is_awaited test/test_case.py::Test_TestCase_and_ChildWatcher::test_watched_process_is_awaited /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:50: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10. out, err = yield from asyncio.wait_for( test/test_case.py::Test_TestCase::test_cleanup_functions_can_be_coroutines /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:320: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def cleanup_coro(): test/test_case.py::Test_TestCase::test_coroutine_returned_executed /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:236: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def set_ran(self): test/test_case.py::Test_TestCase::test_coroutinefunction_executed /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:213: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def runTest(self): test/test_case.py: 4 warnings test/test_mock.py: 97 warnings /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:599: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def proxy(): test/test_case.py::Test_TestCase::test_setup_teardown_may_be_coroutines /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:283: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def setUp(self): test/test_case.py::Test_fail_on_unused_loop::test_fails_when_loop_ran_only_during_cleanup test/test_case.py::Test_fail_on_unused_loop::test_fails_when_loop_ran_only_during_cleanup test/test_case.py::Test_fail_on_unused_loop::test_fails_when_loop_ran_only_during_cleanup test/test_case.py::Test_fail_on_unused_loop::test_fails_when_loop_ran_only_during_cleanup /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:848: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead self.addCleanup(asyncio.coroutine(lambda: None)) test/test_case.py::Test_fail_on_unused_loop::test_passes_when_ignore_loop_or_loop_run /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_case.py:800: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def runTest(self): test/test_helpers.py::TestExhaust::test_exhaust_callbacks_cascading_callbacks test/test_helpers.py::TestExhaust::test_exhaust_callbacks_nothing_to_wait test/test_helpers.py::TestExhaust::test_exhaust_callbacks_one_callback /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_helpers.py:12: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10. return (yield from asyncio.wait_for(coro, loop=self.loop, timeout=1)) test/test_mock.py::Test_CoroutineMock::test_exception_side_effect_raises_in_coroutine test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_counts /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:594: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead result = asyncio.coroutine(_raise)(e) test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_from_side_effect_being_a_coroutine /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:176: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead mock.side_effect = asyncio.coroutine(lambda: 'ProbeValue') test/test_mock.py::Test_CoroutineMock::test_returns_coroutine_with_return_value_being_a_coroutine /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:163: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead coroutine = asyncio.coroutine(lambda: 'ProbeValue') test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_counts /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:550: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def side_effect(): test/test_mock.py::Test_CoroutineMock_awaited::test_awaited_CoroutineMock_sets_awaited /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:531: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def side_effect(): test/test_mock.py::Test_patch::test_patch_is_enabled_when_running_decorated_coroutine /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:971: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine(): test/test_mock.py: 10 warnings /home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py:1001: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead patched = asyncio.coroutine(patched) test/test_mock.py::Test_patch_decorator_coroutine_or_generator::test_coroutine_arg_is_default_mock /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1043: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def tester(coroutine_function): test/test_mock.py::Test_patch_object::test_patch_decorates_coroutine /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1102: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine(): test/test_mock.py::Test_patch_multiple::test_patch_decorates_coroutine /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1140: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine(): test/test_mock.py::Test_patch_dict::test_patch_decorates_class /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1189: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def test_a_coroutine(self): test/test_mock.py::Test_patch_dict::test_patch_decorates_coroutine /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1161: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine(): test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1490: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def tester_coroutine(future): test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1514: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine(future): test/test_mock.py::Test_patch_and_patch_dict_scope::test_both_patch_and_patch_dict_with_scope_global /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1574: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine(): test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1677: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def tester(coro_function): test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope::test_patch_generator_with_multiple_scopes test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_patch_generator_during_its_close /usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1065, in __del__ self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' warnings.warn(pytest.PytestUnraisableExceptionWarning(msg)) test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_deactivate_patch_when_generator_exec_fails test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_deactivate_patch_when_generator_exec_fails /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1334: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine(missing_arg): test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_deactivate_patch_when_generator_exec_fails test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_deactivate_patch_when_generator_exec_fails /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1339: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def tester(): test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_multiple_patches_on_coroutine /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1870: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def tester(coro_function): test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_patch_coroutine_during_its_lifetime /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1788: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def tester(coro_function): test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_GLOBAL::test_patch_stopped_when_generator_is_collected /usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: .a_generator at 0x7fc103ffd190> Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 995, in patched_generator return (yield from patched_factory(*args, **kwargs)) File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1060, in close self._stop_global_patchings() File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 1032, in _stop_global_patchings if _is_started(patching): File "/home/tkloczko/rpmbuild/BUILDROOT/python-asynctest-0.13.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/asynctest/mock.py", line 124, in _is_started return unittest.mock._is_started(patching) AttributeError: module 'unittest.mock' has no attribute '_is_started' warnings.warn(pytest.PytestUnraisableExceptionWarning(msg)) test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_multiple_patches_on_coroutine /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1976: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def tester(coro_function): test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_patch_coroutine_only_when_running /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1928: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def tester(coro_function): test/test_mock.py::Test_patch_decorator_coroutine_or_generator_scope_LIMITED::test_patched_coroutine_with_mock_args /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:1961: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead def a_coroutine(mock): test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_coroutine_side_effect test/test_mock.py::Test_create_autospec::test_create_autospec_on_coroutine_with_coroutine_side_effect /home/tkloczko/rpmbuild/BUILD/asynctest-0.13.0/test/test_mock.py:2175: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead a_coroutine, side_effect=asyncio.coroutine(lambda r: r)) -- Docs: https://docs.pytest.org/en/stable/warnings.html ========================================================================= short test summary info ========================================================================== FAILED doc/examples/tutorial/test_cases.py::AnExempleWhichDetectsPendingCallbacks::test_missing_a_callback - AssertionError: Loop contained unfinished work ( is no... FAILED test/test_mock.py::Test_patch_object::test_patch_decorates_coroutine - AttributeError: module 'unittest.mock' has no attribute '_is_started' FAILED test/test_mock.py::Test_patch_multiple::test_patch_coroutine_function_with_CoroutineMock - AssertionError: is not false FAILED test/test_mock.py::Test_patch_autospec::test_autospec_coroutine - AssertionError: is not... FAILED test/test_mock.py::Test_patch_autospec::test_patch_autospec_with_patches_on_top - AssertionError: False is not true FAILED test/test_mock.py::Test_patch_autospec::test_patch_autospec_with_patches_under - AssertionError: False is not true FAILED test/test_mock.py::Test_patch_autospec::test_patch_multiple_autospec - AssertionError: "arg2" does not match "An asyncio.Future, a coroutine or an awaitable is re... FAILED test/test_mock.py::Test_patch_autospec::test_patch_object_autospec - AssertionError: False is not true FAILED test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_coroutine_with_multiple_scopes - AssertionError: Tuples differ: (True, True)... FAILED test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_generator_with_multiple_scopes - AssertionError: Tuples differ: (True, True)... FAILED test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_patch_generator_with_multiple_scopes_on_same_dict - AssertionError: Tuples differ:... FAILED test/test_mock.py::Test_patch_dict_decorator_coroutine_or_generator_scope::test_scope_limited - AssertionError:
RemiCardona commented 2 years ago

https://github.com/Martiusweb/asynctest/issues/132

TL;DR parts of asynctest are broken on 3.8 and newer

kloczek commented 1 year ago

Gentle ping .. any update? 🤔