Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Python 3.9 support #151

Open
gsauthof opened this issue Jun 8, 2020 · 1 comment
Open

Python 3.9 support #151

gsauthof opened this issue Jun 8, 2020 · 1 comment

Comments

@gsauthof
Copy link

gsauthof commented Jun 8, 2020

Running the asynctest unittests under Python 3.9 yields a bunch of test case failures.

Example:

======================================================================
ERROR: test_patch_generator_with_multiple_scopes (test.Test_patch_decorator_coroutine_or_generator_scope)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/asynctest-0.13.0/test/test_mock.py", line 1650, in test_patch_generator_with_multiple_scopes
    self.assertEqual((True, True), next(gen))
  File "/builddir/build/BUILD/asynctest-0.13.0/asynctest/mock.py", line 995, in patched_generator
    return (yield from patched_factory(*args, **kwargs))
  File "/builddir/build/BUILD/asynctest-0.13.0/asynctest/mock.py", line 985, in patched_factory
    patching.__exit__(*exc_info)
  File "/usr/lib/python3.9/unittest/mock.py", line 1536, in __exit__
    return exit_stack.__exit__(*exc_info)
  File "/usr/lib/python3.9/contextlib.py", line 471, in __exit__
    received_exc = exc_details[0] is not None
IndexError: tuple index out of range
======================================================================
ERROR: test_deactivate_patch_when_generator_exec_fails (test.Test_patch_decorator_coroutine_or_generator_scope_GLOBAL)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/asynctest-0.13.0/test/test_mock.py", line 1739, in test_deactivate_patch_when_generator_exec_fails
    self._test_deactivate_patch_when_generator_exec_fails(asynctest.GLOBAL)
  File "/builddir/build/BUILD/asynctest-0.13.0/test/test_mock.py", line 1348, in _test_deactivate_patch_when_generator_exec_fails
    run_coroutine(tester())
  File "/builddir/build/BUILD/asynctest-0.13.0/test/utils.py", line 9, in run_coroutine
    return loop.run_until_complete(coroutine)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/builddir/build/BUILD/asynctest-0.13.0/test/test_mock.py", line 1341, in tester
    yield from a_coroutine()
  File "/builddir/build/BUILD/asynctest-0.13.0/asynctest/mock.py", line 995, in patched_generator
    return (yield from patched_factory(*args, **kwargs))
  File "/builddir/build/BUILD/asynctest-0.13.0/asynctest/mock.py", line 1044, in __next__
    self._stop_global_patchings()
  File "/builddir/build/BUILD/asynctest-0.13.0/asynctest/mock.py", line 1032, in _stop_global_patchings
    if _is_started(patching):
  File "/builddir/build/BUILD/asynctest-0.13.0/asynctest/mock.py", line 124, in _is_started
    return unittest.mock._is_started(patching)
AttributeError: module 'unittest.mock' has no attribute '_is_started'
-------------------- >> begin captured logging << --------------------
asyncio: DEBUG: Using selector: EpollSelector
--------------------- >> end captured logging << ---------------------
[..]
======================================================================
FAIL: test_patch_as_decorator_uses_CoroutineMock_on_async_coroutine_function (test.test_mock.Test_patch)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/asynctest-0.13.0/test/test_mock.py", line 940, in test_patch_as_decorator_uses_CoroutineMock_on_async_coroutine_function
    test_mock_coroutine()
  File "/usr/lib/python3.9/unittest/mock.py", line 1337, in patched
    return func(*newargs, **newkeywargs)
  File "/builddir/build/BUILD/asynctest-0.13.0/test/test_mock.py", line 937, in test_mock_coroutine
    self.assertIsInstance(mock, asynctest.mock.CoroutineMock)
AssertionError: <MagicMock name='an_async_coroutine' id='4125941040'> is not an instance of <class 'asynctest.mock.CoroutineMock'>

See https://kojipkgs.fedoraproject.org//work/tasks/8916/45078916/build.log for the full log.

The _is_started error is already reported in #149.

@gsauthof
Copy link
Author

Related: Currently, asynctest doesn't support Python 3.8, either, cf. #132 and #144

gentoo-bot pushed a commit to gentoo/guru that referenced this issue May 3, 2021
It doesn't support Python versions greater than 3.7.
See Martiusweb/asynctest#151

Closes: https://bugs.gentoo.org/783996
Signed-off-by: Anna Vyalkova <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant