This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_coroutines fails with --without-threads
Type: Stage: resolved
Components: Tests Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, giampaolo.rodola, gvanrossum, pitrou, python-dev, serhiy.storchaka, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2015-10-10 18:20 by Arfrever, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
coro-skip.diff gvanrossum, 2015-10-10 22:47 review
Messages (10)
msg252735 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2015-10-10 18:20
test.test_coroutines.CoroAsyncIOCompatTest.test_asyncio_1() fails with --without-threads, because it imports asyncio module, which is known to not work with --without-threads.
This test should be skipped when import of asyncio fails.

======================================================================
ERROR: test_asyncio_1 (test.test_coroutines.CoroAsyncIOCompatTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/cpython/Lib/test/test_coroutines.py", line 1325, in test_asyncio_1
    import asyncio
  File "/tmp/cpython/Lib/asyncio/__init__.py", line 21, in <module>
    from .base_events import *
  File "/tmp/cpython/Lib/asyncio/base_events.py", line 18, in <module>
    import concurrent.futures
  File "/tmp/cpython/Lib/concurrent/futures/__init__.py", line 8, in <module>
    from concurrent.futures._base import (FIRST_COMPLETED,
  File "/tmp/cpython/Lib/concurrent/futures/_base.py", line 8, in <module>
    import threading
  File "/tmp/cpython/Lib/threading.py", line 4, in <module>
    import _thread
ImportError: No module named '_thread'

----------------------------------------------------------------------
msg252749 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2015-10-10 22:47
Can you test with this patch?
msg252756 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2015-10-11 04:25
It works.
A more standard way would be 'self.skipTest(...)' instead of 'raise unittest.SkipTest(...)'.
msg252759 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-10-11 04:49
You also can use special helper: test.support.import_module().
msg252760 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2015-10-11 04:55
Can one of you produce a proper patch? Then the other can review. Serhiy can commit it.
msg252776 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-10-11 08:12
New changeset d8737b841fcf by Victor Stinner in branch '3.5':
Close #25367: Fix test_coroutines with no thread support
https://hg.python.org/cpython/rev/d8737b841fcf

New changeset d8002372e5df by Victor Stinner in branch 'default':
Merge 3.5 (test_coroutines, issue #25367)
https://hg.python.org/cpython/rev/d8002372e5df
msg252778 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-10-11 08:13
I fixed the issue based on Guido's patch and Serhiy's suggestion.
msg252779 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2015-10-11 08:20
======================================================================
ERROR: test_asyncio_1 (test.test_coroutines.CoroAsyncIOCompatTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/cpython/Lib/test/test_coroutines.py", line 1351, in test_asyncio_1
    loop = asyncio.new_event_loop()
NameError: name 'asyncio' is not defined

----------------------------------------------------------------------
msg252786 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-10-11 08:54
New changeset 493845d905c5 by Victor Stinner in branch '3.5':
Close #25367: Fix test_coroutines()
https://hg.python.org/cpython/rev/493845d905c5
msg252787 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-10-11 08:54
> NameError: name 'asyncio' is not defined

Oops :-( I also fixed this one, sorry.
History
Date User Action Args
2022-04-11 14:58:22adminsetgithub: 69554
2015-10-11 08:54:33vstinnersetmessages: + msg252787
2015-10-11 08:54:06python-devsetstatus: open -> closed
resolution: fixed
messages: + msg252786

stage: resolved
2015-10-11 08:20:14Arfreversetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg252779

stage: resolved -> (no value)
2015-10-11 08:13:25vstinnersetmessages: + msg252778
2015-10-11 08:12:52python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg252776

resolution: fixed
stage: resolved
2015-10-11 04:55:00gvanrossumsetmessages: + msg252760
2015-10-11 04:49:17serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg252759
2015-10-11 04:25:43Arfreversetmessages: + msg252756
2015-10-10 22:47:33gvanrossumsetfiles: + coro-skip.diff
keywords: + patch
messages: + msg252749
2015-10-10 18:20:01Arfrevercreate