bpo-32273: Move asyncio.test_utils to test.test_asyncio#4785
Merged
Conversation
Contributor
|
It is a backward incompatible change but I support it. |
asvetlov
approved these changes
Dec 11, 2017
9 tasks
bitglue
pushed a commit
to home-assistant/core
that referenced
this pull request
Feb 2, 2018
The module `asyncio.test_utils` has been removed from Python in the 3.7 branch, because it was intended to be a private module for internal testing of asyncio. For more information, see the upstream bug report at https://bugs.python.org/issue32273 and the upstream PR at python/cpython#4785. For this commit, I have migrated the small amount of functionality that was being used from the `asyncio.test_utils` directly into the `RunThreadsafeTests` Class. To see the original `asyncio.test_utils.TestCase` class, which I pulled some functionality from, please see: https://github.com/python/cpython/blob/3.6/Lib/asyncio/test_utils.py#L440 Note: In addition to being broken in 3.7, this test case also seems to be broken in Python 3.6.4 when using Docker. This PR fixes the test when run in docker. To reproduce: `./script/test_docker -- tests/util/test_async.py` failing output (prior to this commit): ``` ... trimmed ... py36 runtests: PYTHONHASHSEED='3262989550' py36 runtests: commands[0] | py.test --timeout=9 --duration=10 --cov --cov-report= tests/util/test_async.py Test session starts (platform: linux, Python 3.6.4, pytest 3.3.1, pytest-sugar 0.9.0) rootdir: /usr/src/app, inifile: setup.cfg plugins: timeout-1.2.1, sugar-0.9.0, cov-2.5.1, aiohttp-0.3.0 timeout: 9.0s method: signal ―――――――――――――――――― ERROR collecting tests/util/test_async.py ―――――――――――――――――――――――― ImportError while importing test module '/usr/src/app/tests/util/test_async.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/util/test_async.py:3: in <module> from asyncio import test_utils /usr/local/lib/python3.6/asyncio/test_utils.py:36: in <module> from test import support E ImportError: cannot import name 'support' ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue32273