kyuupichan / aiorpcX

Generic async RPC implementation, including JSON-RPC
MIT License
27 stars 23 forks source link

test failures with py 3.8 #30

Closed jirislaby closed 3 years ago

jirislaby commented 4 years ago

We, at SUSE, are currently seeing 5 failures with python 3.8. The full log is at https://build.opensuse.org/package/live_build_log/devel:languages:python/python-aiorpcX/openSUSE_Tumbleweed/x86_64 An excerpt with failures:

[   67s] =================================== FAILURES ===================================
[   67s] _________________________ test_nested_context_timeout2 _________________________
[   67s] 
[   67s] pyfuncitem = <Function test_nested_context_timeout2>
[   67s] 
[   67s]     @pytest.mark.tryfirst
[   67s]     def pytest_pyfunc_call(pyfuncitem):
[   67s]         """
[   67s]         Run asyncio marked test functions in an event loop instead of a normal
[   67s]         function call.
[   67s]         """
[   67s]         for marker_name, fixture_name in _markers_2_fixtures.items():
[   67s]             if marker_name in pyfuncitem.keywords \
[   67s]                     and not getattr(pyfuncitem.obj, 'is_hypothesis_test', False):
[   67s]                 event_loop = pyfuncitem.funcargs[fixture_name]
[   67s]     
[   67s]                 funcargs = pyfuncitem.funcargs
[   67s]                 testargs = {arg: funcargs[arg]
[   67s]                             for arg in pyfuncitem._fixtureinfo.argnames}
[   67s]     
[   67s] >               event_loop.run_until_complete(
[   67s]                     asyncio.ensure_future(
[   67s]                         pyfuncitem.obj(**testargs), loop=event_loop))
[   67s] 
[   67s] /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:156: 
[   67s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   67s] 
[   67s] self = <_UnixSelectorEventLoop running=False closed=False debug=False>
[   67s] future = <Task cancelled name='Task-167' coro=<test_nested_context_timeout2() done, defined at /home/abuild/rpmbuild/BUILD/aiorpcX-0.18.4/tests/test_curio.py:528>>
[   67s] 
[   67s]     def run_until_complete(self, future):
[   67s]         """Run until the Future is done.
[   67s]     
[   67s]         If the argument is a coroutine, it is wrapped in a Task.
[   67s]     
[   67s]         WARNING: It would be disastrous to call run_until_complete()
[   67s]         with the same coroutine twice -- it would wrap it in two
[   67s]         different Tasks and that can't be good.
[   67s]     
[   67s]         Return the Future's result, or raise its exception.
[   67s]         """
[   67s]         self._check_closed()
[   67s]         self._check_running()
[   67s]     
[   67s]         new_task = not futures.isfuture(future)
[   67s]         future = tasks.ensure_future(future, loop=self)
[   67s]         if new_task:
[   67s]             # An exception is raised if the future didn't complete, so there
[   67s]             # is no need to log the "destroy pending task" message
[   67s]             future._log_destroy_pending = False
[   67s]     
[   67s]         future.add_done_callback(_run_until_complete_cb)
[   67s]         try:
[   67s]             self.run_forever()
[   67s]         except:
[   67s]             if new_task and future.done() and not future.cancelled():
[   67s]                 # The coroutine raised a BaseException. Consume the exception
[   67s]                 # to not log a warning, the caller doesn't have access to the
[   67s]                 # local task.
[   67s]                 future.exception()
[   67s]             raise
[   67s]         finally:
[   67s]             future.remove_done_callback(_run_until_complete_cb)
[   67s]         if not future.done():
[   67s]             raise RuntimeError('Event loop stopped before Future completed.')
[   67s]     
[   67s] >       return future.result()
[   67s] E       asyncio.exceptions.CancelledError
[   67s] 
[   67s] /usr/lib64/python3.8/asyncio/base_events.py:616: CancelledError
[   67s] _________________________ test_nested_context_timeout3 _________________________
[   67s] 
[   67s] pyfuncitem = <Function test_nested_context_timeout3>
[   67s] 
[   67s]     @pytest.mark.tryfirst
[   67s]     def pytest_pyfunc_call(pyfuncitem):
[   67s]         """
[   67s]         Run asyncio marked test functions in an event loop instead of a normal
[   67s]         function call.
[   67s]         """
[   67s]         for marker_name, fixture_name in _markers_2_fixtures.items():
[   67s]             if marker_name in pyfuncitem.keywords \
[   67s]                     and not getattr(pyfuncitem.obj, 'is_hypothesis_test', False):
[   67s]                 event_loop = pyfuncitem.funcargs[fixture_name]
[   67s]     
[   67s]                 funcargs = pyfuncitem.funcargs
[   67s]                 testargs = {arg: funcargs[arg]
[   67s]                             for arg in pyfuncitem._fixtureinfo.argnames}
[   67s]     
[   67s] >               event_loop.run_until_complete(
[   67s]                     asyncio.ensure_future(
[   67s]                         pyfuncitem.obj(**testargs), loop=event_loop))
[   67s] 
[   67s] /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:156: 
[   67s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   67s] 
[   67s] self = <_UnixSelectorEventLoop running=False closed=False debug=False>
[   67s] future = <Task cancelled name='Task-168' coro=<test_nested_context_timeout3() done, defined at /home/abuild/rpmbuild/BUILD/aiorpcX-0.18.4/tests/test_curio.py:565>>
[   67s] 
[   67s]     def run_until_complete(self, future):
[   67s]         """Run until the Future is done.
[   67s]     
[   67s]         If the argument is a coroutine, it is wrapped in a Task.
[   67s]     
[   67s]         WARNING: It would be disastrous to call run_until_complete()
[   67s]         with the same coroutine twice -- it would wrap it in two
[   67s]         different Tasks and that can't be good.
[   67s]     
[   67s]         Return the Future's result, or raise its exception.
[   67s]         """
[   67s]         self._check_closed()
[   67s]         self._check_running()
[   67s]     
[   67s]         new_task = not futures.isfuture(future)
[   67s]         future = tasks.ensure_future(future, loop=self)
[   67s]         if new_task:
[   67s]             # An exception is raised if the future didn't complete, so there
[   67s]             # is no need to log the "destroy pending task" message
[   67s]             future._log_destroy_pending = False
[   67s]     
[   67s]         future.add_done_callback(_run_until_complete_cb)
[   67s]         try:
[   67s]             self.run_forever()
[   67s]         except:
[   67s]             if new_task and future.done() and not future.cancelled():
[   67s]                 # The coroutine raised a BaseException. Consume the exception
[   67s]                 # to not log a warning, the caller doesn't have access to the
[   67s]                 # local task.
[   67s]                 future.exception()
[   67s]             raise
[   67s]         finally:
[   67s]             future.remove_done_callback(_run_until_complete_cb)
[   67s]         if not future.done():
[   67s]             raise RuntimeError('Event loop stopped before Future completed.')
[   67s]     
[   67s] >       return future.result()
[   67s] E       asyncio.exceptions.CancelledError
[   67s] 
[   67s] /usr/lib64/python3.8/asyncio/base_events.py:616: CancelledError
[   67s] ___________________________ test_handler_invocation ____________________________
[   67s] 
[   67s]     def test_handler_invocation():
[   67s]         # Peculiar function signatures
[   67s]     
[   67s]         # pow - Built-in; 2 positional args, 1 optional 3rd named arg
[   67s]         powb = pow
[   67s]     
[   67s]         def add_3(x, y, z=0):
[   67s]             return x + y + z
[   67s]     
[   67s]         def add_many(first, second=0, *values):
[   67s]             values += (first, second)
[   67s]             return sum(values)
[   67s]     
[   67s]         def echo_2(first, *, second=2):
[   67s]             return [first, second]
[   67s]     
[   67s]         def kwargs(start, *kwargs):
[   67s]             return start + len(kwargs)
[   67s]     
[   67s]         def both(start=2, *args, **kwargs):
[   67s]             return start + len(args) * 10 + len(kwargs) * 4
[   67s]     
[   67s]         good_requests = (
[   67s]             (Request('add_3', (1, 2, 3)), 6),
[   67s]             (Request('add_3', [5, 7]), 12),
[   67s]             (Request('add_3', {'x': 5, 'y': 7}), 12),
[   67s]             (Request('add_3', {'x': 5, 'y': 7, 'z': 3}), 15),
[   67s]             (Request('add_many', [1]), 1),
[   67s]             (Request('add_many', [5, 50, 500]), 555),
[   67s]             (Request('add_many', list(range(10))), 45),
[   67s]             (Request('add_many', {'first': 1}), 1),
[   67s]             (Request('add_many', {'first': 1, 'second': 10}), 11),
[   67s]             (Request('powb', [2, 3]), 8),
[   67s]             (Request('powb', [2, 3, 5]), 3),
[   67s]             (Request('echo_2', ['ping']), ['ping', 2]),
[   67s]             (Request('echo_2', {'first': 1, 'second': 8}), [1, 8]),
[   67s]             (Request('kwargs', [1]), 1),
[   67s]             (Request('kwargs', [1, 2]), 2),
[   67s]             (Request('kwargs', {'start': 3}), 3),
[   67s]             (Request('both', []), 2),
[   67s]             (Request('both', [1]), 1),
[   67s]             (Request('both', [5, 2]), 15),
[   67s]             (Request('both', {'end': 4}), 6),
[   67s]             (Request('both', {'start': 3}), 3),
[   67s]             (Request('both', {'start': 3, 'end': 1, '3rd': 1}), 11),
[   67s]         )
[   67s]     
[   67s]         for request, result in good_requests:
[   67s]             handler = locals()[request.method]
[   67s]             invocation = handler_invocation(handler, request)
[   67s]             assert invocation() == result
[   67s]     
[   67s]         bad_requests = (
[   67s]             (Request('missing_method', []), 'unknown method'),
[   67s]             (Request('add_many', []), 'requires 1'),
[   67s]             (Request('add_many', {'first': 1, 'values': []}), 'values'),
[   67s]             (Request('powb', {"x": 2, "y": 3}), 'cannot be called'),
[   67s]             (Request('echo_2', ['ping', 'pong']), 'at most 1'),
[   67s]             (Request('echo_2', {'first': 1, 'second': 8, '3rd': 1}), '3rd'),
[   67s]             (Request('kwargs', []), 'requires 1'),
[   67s]             (Request('kwargs', {'end': 4}), "start"),
[   67s]             (Request('kwargs', {'start': 3, 'end': 1, '3rd': 1}), '3rd'),
[   67s]         )
[   67s]     
[   67s]         for request, text in bad_requests:
[   67s]             with pytest.raises(RPCError) as e:
[   67s]                 handler = locals().get(request.method)
[   67s]                 handler_invocation(handler, request)
[   67s] >           assert text in e.value.message
[   67s] E           assert 'cannot be called' in 'method "powb" requires parameters "base", "exp"'
[   67s] E            +  where 'method "powb" requires parameters "base", "exp"' = RPCError(-32602, 'method "powb" requires parameters "base", "exp"').message
[   67s] E            +    where RPCError(-32602, 'method "powb" requires parameters "base", "exp"') = <ExceptionInfo RPCError(-32602, 'method "powb" requires parameters "base", "exp"') tblen=2>.value
[   67s] 
[   67s] tests/test_jsonrpc.py:1141: AssertionError
[   67s] ______________________ TestSOCKSProxy.test_random[False] _______________________
[   67s] 
[   67s] self = <test_socks.TestSOCKSProxy object at 0x7f3f18f5eb20>
[   67s] 
[   67s]     def test_random(self):
[   67s]         auth1 = auth_methods[1]
[   67s]         auth2 = SOCKSRandomAuth()
[   67s]     
[   67s]         # SOCKSRandomAuth is a SOCKSUserAuth
[   67s]         assert isinstance(auth2, SOCKSUserAuth)
[   67s]     
[   67s]         # Username of SOCKSUserAuth should be constant
[   67s]         user1a = auth1.username
[   67s]         user1b = auth1.username
[   67s]         assert user1a == user1b
[   67s]     
[   67s]         # Password of SOCKSUserAuth should be constant
[   67s]         pass1a = auth1.password
[   67s]         pass1b = auth1.password
[   67s]         assert pass1a == pass1b
[   67s]     
[   67s]         # Username of SOCKSRandomAuth should be random
[   67s]         user2a = auth2.username
[   67s]         user2b = auth2.username
[   67s] >       assert user2a != user2b
[   67s] E       assert None != None
[   67s] 
[   67s] tests/test_socks.py:652: AssertionError
[   67s] _______________________ TestSOCKSProxy.test_random[True] _______________________
[   67s] 
[   67s] self = <test_socks.TestSOCKSProxy object at 0x7f3f1831ee80>
[   67s] 
[   67s]     def test_random(self):
[   67s]         auth1 = auth_methods[1]
[   67s]         auth2 = SOCKSRandomAuth()
[   67s]     
[   67s]         # SOCKSRandomAuth is a SOCKSUserAuth
[   67s]         assert isinstance(auth2, SOCKSUserAuth)
[   67s]     
[   67s]         # Username of SOCKSUserAuth should be constant
[   67s]         user1a = auth1.username
[   67s]         user1b = auth1.username
[   67s]         assert user1a == user1b
[   67s]     
[   67s]         # Password of SOCKSUserAuth should be constant
[   67s]         pass1a = auth1.password
[   67s]         pass1b = auth1.password
[   67s]         assert pass1a == pass1b
[   67s]     
[   67s]         # Username of SOCKSRandomAuth should be random
[   67s]         user2a = auth2.username
[   67s]         user2b = auth2.username
[   67s] >       assert user2a != user2b
[   67s] E       assert None != None
[   67s] 
[   67s] tests/test_socks.py:652: AssertionError
[   67s] =============================== warnings summary ===============================
[   67s] tests/test_session.py::TestRPCSession::test_handlers[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_request[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_request_buggy_handler[True]
[   67s] tests/test_session.py::TestRPCSession::test_unexpected_response[True]
[   67s] tests/test_session.py::TestRPCSession::test_unanswered_request_count[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_request_bad_args[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_request_timeout0[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_request_timeout[True]
[   67s] tests/test_session.py::TestRPCSession::test_error_base_cost[True]
[   67s] tests/test_session.py::TestRPCSession::test_RPCError_cost[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_notification[True]
[   67s] tests/test_session.py::TestRPCSession::test_force_close[True]
[   67s] tests/test_session.py::TestRPCSession::test_force_close_abort_codepath[True]
[   67s] tests/test_session.py::TestRPCSession::test_verbose_logging[True]
[   67s] tests/test_session.py::TestRPCSession::test_framer_MemoryError[True]
[   67s] tests/test_session.py::TestRPCSession::test_pausing[True]
[   67s] tests/test_session.py::TestRPCSession::test_concurrency[True]
[   67s] tests/test_session.py::TestRPCSession::test_concurrency_no_limit_for_outgoing[True]
[   67s] tests/test_session.py::TestRPCSession::test_concurrency_decay[True]
[   67s] tests/test_session.py::TestRPCSession::test_concurrency_hard_limit_0[True]
[   67s] tests/test_session.py::TestRPCSession::test_extra_cost[True]
[   67s] tests/test_session.py::TestRPCSession::test_request_over_hard_limit[True]
[   67s] tests/test_session.py::TestRPCSession::test_request_sleep[True]
[   67s] tests/test_session.py::TestRPCSession::test_server_busy[True]
[   67s] tests/test_session.py::TestRPCSession::test_reply_and_disconnect_value[True]
[   67s] tests/test_session.py::TestRPCSession::test_reply_and_disconnect_error[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_empty_batch[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_batch[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_batch_errors_quiet[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_batch_errors[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_batch_cancelled[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_batch_bad_request[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_request_throttling[True]
[   67s] tests/test_session.py::TestRPCSession::test_send_batch_throttling[True]
[   67s] tests/test_session.py::TestRPCSession::test_sent_request_timeout[True]
[   67s] tests/test_session.py::TestRPCSession::test_log_me[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_request[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_request_named[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_notification[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_non_existent_notification[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_non_existent_method[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_invalid_json[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_invalid_request_object[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_batch_invalid_json[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_empty_batch[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_invalid_batch[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_invalid_batch_3[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_partly_invalid_batch[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_mixed_batch[True]
[   67s] tests/test_session.py::TestWireResponses::test_send_notification_batch[True]
[   67s] tests/test_session.py::TestMessageSession::test_basic_send[True]
[   67s] tests/test_session.py::TestMessageSession::test_many_sends[True]
[   67s] tests/test_session.py::TestMessageSession::test_errors[True]
[   67s] tests/test_session.py::TestMessageSession::test_bad_magic[True]
[   67s] tests/test_session.py::TestMessageSession::test_bad_checksum[True]
[   67s] tests/test_session.py::TestMessageSession::test_oversized_message[True]
[   67s] tests/test_session.py::TestMessageSession::test_oversized_message[True]
[   67s] tests/test_session.py::TestMessageSession::test_request_sleeps[True]
[   67s] tests/test_session.py::TestMessageSession::test_request_over_hard_limit[True]
[   67s] tests/test_session.py::TestMessageSession::test_server_busy[True]
[   67s]   /home/abuild/rpmbuild/BUILD/aiorpcX-0.18.4/aiorpcx/rawsocket.py:162: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
[   67s]     return await connector.create_connection(
[   67s] 
[   67s] -- Docs: https://docs.pytest.org/en/latest/warnings.html
[   67s] ========== 5 failed, 1008 passed, 14 deselected, 60 warnings in 7.15s ==========
mgorny commented 4 years ago

Ping.

kyuupichan commented 3 years ago

Fixed in git head