core/tests
Marc Khouri 72c35468b3 Remove asyncio.test_utils to fix tests in Docker/Python 3.7 (#12102)
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 https://github.com/python/cpython/pull/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'
```
2018-02-02 14:59:05 +00:00
..
components OpenALPR Cloud API - transfer image in body of POST request (#12112) 2018-02-02 14:19:13 +01:00
fixtures Pushbullet (fix) invalid keyword, added unittests (#11804) 2018-01-24 21:06:35 +01:00
helpers Entity registry (#11979) 2018-01-30 10:39:39 +01:00
mock Tests for zwave setup features (#7570) 2017-05-12 20:27:44 -07:00
resources Revised package util tests 2016-01-30 14:08:32 -05:00
scripts Remove http.development (#10267) 2017-11-01 13:07:16 +01:00
test_util Flake8 bugbear fixes (#12072) 2018-01-30 14:44:05 -08:00
testing_config Add Kira component to sensor and remote platforms (#7479) 2017-05-12 21:12:47 -07:00
util Remove asyncio.test_utils to fix tests in Docker/Python 3.7 (#12102) 2018-02-02 14:59:05 +00:00
__init__.py async HTTP component (#3914) 2016-10-23 23:48:01 -07:00
common.py Entity registry (#11979) 2018-01-30 10:39:39 +01:00
conftest.py Abort tests when instances leaked (#7623) 2017-05-18 00:19:40 +02:00
test_bootstrap.py Spelling fixes (#11940) 2018-01-27 11:58:27 -08:00
test_config.py Core support for hass.io calls & Bugfix check_config (#11571) 2018-01-12 15:29:58 +01:00
test_core.py Flake8 bugbear fixes (#12072) 2018-01-30 14:44:05 -08:00
test_loader.py RFC: Use bind_hass for helpers (#9745) 2017-10-08 08:17:54 -07:00
test_main.py Migrate core from threads to async awesomeness (#3248) 2016-09-12 19:16:14 -07:00
test_remote.py Spelling fixes (#11940) 2018-01-27 11:58:27 -08:00
test_requirements.py Extract requirements (#12051) 2018-01-30 12:30:47 +01:00
test_setup.py Extract requirements (#12051) 2018-01-30 12:30:47 +01:00