Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1025924: python-rx: Fails to build with Python 3.11 (AttributeError: module 'asyncio' has no attribute 'coroutine')

807 views
Skip to first unread message

Colin Watson

unread,
Dec 11, 2022, 5:40:04 PM12/11/22
to
Source: python-rx
Version: 3.2.0-2
Severity: serious
Tags: upstream ftbfs
Justification: fails to build from source

python-rx fails to build now that tests are being run on Python 3.11.
Here are the failures from pytest:

=================================== FAILURES ===================================
______________________ TestFromFuture.test_future_cancel _______________________

self = <tests.test_observable.test_fromfuture.TestFromFuture testMethod=test_future_cancel>

def test_future_cancel(self):
loop = asyncio.get_event_loop()
success = [True, False, True]

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_observable/test_fromfuture.py:66: AttributeError
______________________ TestFromFuture.test_future_dispose ______________________

self = <tests.test_observable.test_fromfuture.TestFromFuture testMethod=test_future_dispose>

def test_future_dispose(self):
loop = asyncio.get_event_loop()
success = [True, True, True]

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_observable/test_fromfuture.py:90: AttributeError
______________________ TestFromFuture.test_future_failure ______________________

self = <tests.test_observable.test_fromfuture.TestFromFuture testMethod=test_future_failure>

def test_future_failure(self):
loop = asyncio.get_event_loop()
success = [True, False, True]

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_observable/test_fromfuture.py:39: AttributeError
______________________ TestFromFuture.test_future_success ______________________

self = <tests.test_observable.test_fromfuture.TestFromFuture testMethod=test_future_success>

def test_future_success(self):
loop = asyncio.get_event_loop()
success = [False, True, False]

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_observable/test_fromfuture.py:14: AttributeError
__________________________ TestStart.test_start_async __________________________

self = <tests.test_observable.test_start.TestStart testMethod=test_start_async>

def test_start_async(self):
loop = asyncio.get_event_loop()
success = [False]

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_observable/test_start.py:23: AttributeError
_______________________ TestStart.test_start_async_error _______________________

self = <tests.test_observable.test_start.TestStart testMethod=test_start_async_error>

def test_start_async_error(self):
loop = asyncio.get_event_loop()
success = [False]

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_observable/test_start.py:43: AttributeError
______________ TestAsyncIOScheduler.test_asyncio_schedule_action _______________

self = <tests.test_scheduler.test_eventloop.test_asyncioscheduler.TestAsyncIOScheduler testMethod=test_asyncio_schedule_action>

def test_asyncio_schedule_action(self):
loop = asyncio.get_event_loop()

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_scheduler/test_eventloop/test_asyncioscheduler.py:33: AttributeError
___________ TestAsyncIOScheduler.test_asyncio_schedule_action_cancel ___________

self = <tests.test_scheduler.test_eventloop.test_asyncioscheduler.TestAsyncIOScheduler testMethod=test_asyncio_schedule_action_cancel>

def test_asyncio_schedule_action_cancel(self):
loop = asyncio.get_event_loop()

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_scheduler/test_eventloop/test_asyncioscheduler.py:80: AttributeError
____________ TestAsyncIOScheduler.test_asyncio_schedule_action_due _____________

self = <tests.test_scheduler.test_eventloop.test_asyncioscheduler.TestAsyncIOScheduler testMethod=test_asyncio_schedule_action_due>

def test_asyncio_schedule_action_due(self):
loop = asyncio.get_event_loop()

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_scheduler/test_eventloop/test_asyncioscheduler.py:55: AttributeError
____ TestAsyncIOThreadSafeScheduler.test_asyncio_threadsafe_schedule_action ____

self = <tests.test_scheduler.test_eventloop.test_asynciothreadsafescheduler.TestAsyncIOThreadSafeScheduler testMethod=test_asyncio_threadsafe_schedule_action>

def test_asyncio_threadsafe_schedule_action(self):
loop = asyncio.get_event_loop()

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py:34: AttributeError
_ TestAsyncIOThreadSafeScheduler.test_asyncio_threadsafe_schedule_action_cancel _

self = <tests.test_scheduler.test_eventloop.test_asynciothreadsafescheduler.TestAsyncIOThreadSafeScheduler testMethod=test_asyncio_threadsafe_schedule_action_cancel>

def test_asyncio_threadsafe_schedule_action_cancel(self):
loop = asyncio.get_event_loop()

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py:87: AttributeError
_ TestAsyncIOThreadSafeScheduler.test_asyncio_threadsafe_schedule_action_cancel_same_loop _

self = <tests.test_scheduler.test_eventloop.test_asynciothreadsafescheduler.TestAsyncIOThreadSafeScheduler testMethod=test_asyncio_threadsafe_schedule_action_cancel_same_loop>

def test_asyncio_threadsafe_schedule_action_cancel_same_loop(self):
def test_body(scheduler, action, update_state):
d = scheduler.schedule_relative(0.1, action)

def do_dispose():
d.dispose()
update_state['dispose_completed'] = True

# Test case when dispose is called in loop's callback.
scheduler._loop.call_soon(do_dispose)

> self.cancel_same_thread_common(test_body)

tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py:179:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tests.test_scheduler.test_eventloop.test_asynciothreadsafescheduler.TestAsyncIOThreadSafeScheduler testMethod=test_asyncio_threadsafe_schedule_action_cancel_same_loop>
test_body = <function TestAsyncIOThreadSafeScheduler.test_asyncio_threadsafe_schedule_action_cancel_same_loop.<locals>.test_body at 0x7fc4e6c13420>

def cancel_same_thread_common(self, test_body):
update_state = {
'ran': False,
'dispose_completed': False
}

def action(scheduler, state):
update_state['ran'] = True

# Make the actual test body run in deamon thread, so that in case of
# failure it doesn't hang indefinitely.
def thread_target():
loop = asyncio.new_event_loop()
scheduler = AsyncIOThreadSafeScheduler(loop)

test_body(scheduler, action, update_state)

@asyncio.coroutine
def go():
kwargs = {}
if version_info[:2] < (3, 10):
kwargs['loop'] = loop
yield from asyncio.sleep(0.2, **kwargs)

loop.run_until_complete(go())

thread = threading.Thread(target=thread_target)
thread.daemon = True
thread.start()
thread.join(0.3)
> assert update_state['dispose_completed'] is True
E assert False is True

tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py:140: AssertionError
__ TestAsyncIOThreadSafeScheduler.test_asyncio_threadsafe_schedule_action_due __

self = <tests.test_scheduler.test_eventloop.test_asynciothreadsafescheduler.TestAsyncIOThreadSafeScheduler testMethod=test_asyncio_threadsafe_schedule_action_due>

def test_asyncio_threadsafe_schedule_action_due(self):
loop = asyncio.get_event_loop()

> @asyncio.coroutine
E AttributeError: module 'asyncio' has no attribute 'coroutine'

tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py:59: AttributeError
=============================== warnings summary ===============================
.pybuild/cpython3_3.11_rx/build/tests/test_observable/test_flatmap_async.py::TestFlatMapAsync::test_flat_map_async
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_rx/build/tests/test_observable/test_flatmap_async.py:13: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()

.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_timeoutscheduler.py::TestTimeoutScheduler::test_timeout_schedule_action
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_rx/build/rx/scheduler/timeoutscheduler.py:51: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
timer.setDaemon(True)

.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_timeoutscheduler.py::TestTimeoutScheduler::test_timeout_schedule_action_cancel
.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_timeoutscheduler.py::TestTimeoutScheduler::test_timeout_schedule_action_due
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_rx/build/rx/scheduler/timeoutscheduler.py:86: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
timer.setDaemon(True)

.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_eventloop/test_asyncioscheduler.py::TestAsyncIOScheduler::test_asyncio_schedule_now_units
/usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method TestAsyncIOScheduler.test_asyncio_schedule_now_units of <tests.test_scheduler.test_eventloop.test_asyncioscheduler.TestAsyncIOScheduler testMethod=test_asyncio_schedule_now_units>>)
return self.run(*args, **kwds)

.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py::TestAsyncIOThreadSafeScheduler::test_asyncio_threadsafe_cancel_non_relative_same_thread
/usr/lib/python3/dist-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-115 (thread_target)

Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py", line 127, in thread_target
@asyncio.coroutine
^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'

warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))

.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py::TestAsyncIOThreadSafeScheduler::test_asyncio_threadsafe_schedule_action_cancel_same_loop
/usr/lib/python3/dist-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-116 (thread_target)

Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py", line 127, in thread_target
@asyncio.coroutine
^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'

warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))

.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py::TestAsyncIOThreadSafeScheduler::test_asyncio_threadsafe_schedule_action_cancel_same_thread
/usr/lib/python3/dist-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-117 (thread_target)

Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py", line 127, in thread_target
@asyncio.coroutine
^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'

warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))

.pybuild/cpython3_3.11_rx/build/tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py::TestAsyncIOThreadSafeScheduler::test_asyncio_threadsafe_schedule_now_units
/usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method TestAsyncIOThreadSafeScheduler.test_asyncio_threadsafe_schedule_now_units of <tests.test_scheduler.test_eventloop.test_asynciothreadsafescheduler.TestAsyncIOThreadSafeScheduler testMethod=test_asyncio_threadsafe_schedule_now_units>>)
return self.run(*args, **kwds)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_observable/test_fromfuture.py::TestFromFuture::test_future_cancel
FAILED tests/test_observable/test_fromfuture.py::TestFromFuture::test_future_dispose
FAILED tests/test_observable/test_fromfuture.py::TestFromFuture::test_future_failure
FAILED tests/test_observable/test_fromfuture.py::TestFromFuture::test_future_success
FAILED tests/test_observable/test_start.py::TestStart::test_start_async - Att...
FAILED tests/test_observable/test_start.py::TestStart::test_start_async_error
FAILED tests/test_scheduler/test_eventloop/test_asyncioscheduler.py::TestAsyncIOScheduler::test_asyncio_schedule_action
FAILED tests/test_scheduler/test_eventloop/test_asyncioscheduler.py::TestAsyncIOScheduler::test_asyncio_schedule_action_cancel
FAILED tests/test_scheduler/test_eventloop/test_asyncioscheduler.py::TestAsyncIOScheduler::test_asyncio_schedule_action_due
FAILED tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py::TestAsyncIOThreadSafeScheduler::test_asyncio_threadsafe_schedule_action
FAILED tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py::TestAsyncIOThreadSafeScheduler::test_asyncio_threadsafe_schedule_action_cancel
FAILED tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py::TestAsyncIOThreadSafeScheduler::test_asyncio_threadsafe_schedule_action_cancel_same_loop
FAILED tests/test_scheduler/test_eventloop/test_asynciothreadsafescheduler.py::TestAsyncIOThreadSafeScheduler::test_asyncio_threadsafe_schedule_action_due
=========== 13 failed, 1309 passed, 10 skipped, 9 warnings in 20.51s ===========
E: pybuild pybuild:386: test: plugin distutils failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_rx/build; python3.11 -m pytest tests

This looks like https://github.com/ReactiveX/RxPY/issues/588, but it
also seems that we're several upstream versions behind. Would packaging
4.0.4 be in order? If this is too big a migration though (I see from
https://github.com/ReactiveX/RxPY/blob/master/docs/migration.rst that it
doesn't look entirely trivial), at least cherry-picking that fix for now
would probably be a good idea.

Thanks,

--
Colin Watson (he/him) [cjwa...@debian.org]
0 new messages