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

Migrate asynctest to stdlib's AsyncMock #9

Closed
eclipseo opened this issue Sep 4, 2020 · 4 comments
Closed

Migrate asynctest to stdlib's AsyncMock #9

eclipseo opened this issue Sep 4, 2020 · 4 comments
Assignees
Labels
bug Something isn't working can't reproduce Unable to reproduce the issue described.

Comments

@eclipseo
Copy link

eclipseo commented Sep 4, 2020

Asynctest doesn't work with python 3.8 and above.

Asynctest upstream is aware of this breakage and recommends using the built-in AsyncMock instead. See also Martiusweb/asynctest#144 and Martiusweb/asynctest#126 .

@eclipseo eclipseo added the bug Something isn't working label Sep 4, 2020
@Voyz Voyz self-assigned this Sep 5, 2020
@Voyz
Copy link
Owner

Voyz commented Sep 5, 2020

Thank you for reporting @eclipseo! 😊 I've tried reproducing the errors described in the issues you linked, yet to no avail - all tests succeed on Python 3.8.5, Databay 0.1.5. I can carry out the migration to AsyncMock right away, but I'd first like to know that I'm fixing whatever issues happen using asynctest on Python 3.8.

I'm assuming you tried running the tests and they failed for you? It would be great to know which tests failed and in what way.

Could you please provide more details? Use the following template if you may:


Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Environment
Databay version:
Python version:
OS:

Additional context
Add any other context about the problem here.

Suggest a Fix
If you can't fix the bug yourself, perhaps you can point to what might be causing the problem (line of code or commit).


Thank you!

@Voyz Voyz added the can't reproduce Unable to reproduce the issue described. label Sep 5, 2020
@fabaff
Copy link

fabaff commented Sep 25, 2020

On a Fedora system (local build for the RPM package):

[...]
platform linux -- Python 3.8.5, pytest-4.6.11, py-1.8.2, pluggy-0.13.1 -- /usr/bin/python3
[...]
test/test/unit/outlets/test_print_outlet.py::TestPrintOutlet::test_push PASSED                                                                                                                                               [ 98%]
test/test/unit/outlets/test_print_outlet.py::TestPrintOutlet::test_push_only_payload PASSED                                                                                                                                  [ 99%]
test/test/unit/outlets/test_print_outlet.py::TestPrintOutlet::test_push_skip_update PASSED                                                                                                                                   [100%]

============================================================================================================= FAILURES =============================================================================================================
______________________________________________________________________________________________ TestConfig.test_event_loop_policy_3_7 _______________________________________________________________________________________________

self = <test.unit.test_config.TestConfig testMethod=test_event_loop_policy_3_7>, version_info = <MagicMock name='version_info' id='140633192203696'>

    @patch('sys.platform', 'win32')
    @patch('sys.version_info')
    def test_event_loop_policy_3_7(self, version_info):
        version_info.__getitem__.side_effect = lambda x: [3, 7][x]
    
        # fake a manual 3.8 default setup
>       asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
E       AttributeError: module 'asyncio' has no attribute 'WindowsProactorEventLoopPolicy'

test/test/unit/test_config.py:36: AttributeError
______________________________________________________________________________________________ TestConfig.test_event_loop_policy_3_8 _______________________________________________________________________________________________

self = <test.unit.test_config.TestConfig testMethod=test_event_loop_policy_3_8>, version_info = <MagicMock name='version_info' id='140633192146640'>

    @patch('sys.platform', 'win32')
    @patch('sys.version_info')
    def test_event_loop_policy_3_8(self, version_info):
        version_info.__getitem__.side_effect = lambda x: [3, 8][x]
    
        # fake a 3.8 default setup
>       asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
E       AttributeError: module 'asyncio' has no attribute 'WindowsProactorEventLoopPolicy'

test/test/unit/test_config.py:24: AttributeError
========================================================================================================= warnings summary =========================================================================================================
/usr/lib/python3.8/site-packages/asynctest/mock.py:434
  /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):

/usr/lib/python3.8/site-packages/asynctest/mock.py:448

@Voyz
Copy link
Owner

Voyz commented Sep 28, 2020

Thanks @fabaff for this report. This one in particular seems to be unrelated from the asynctest issue and is an issue of its own, as instead it is caused by running windows-specific test on a non-windows platform. If you had any error logs from the asynctest tests under Python 3.8 we'd appreciate these too.

@Voyz
Copy link
Owner

Voyz commented Dec 17, 2020

We just released version 0.2.0 that should address this issue. Please reopen if the problems persist. Thanks for submitting it 👋

@Voyz Voyz closed this as completed Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working can't reproduce Unable to reproduce the issue described.
Projects
None yet
Development

No branches or pull requests

3 participants