Make typing checks more strict (#14429)

## Description:

Make typing checks more strict: add `--strict-optional` flag that forbids implicit None return type. This flag will become default in the next version of mypy (0.600)

Add `homeassistant/util/` to checked dirs.

## Checklist:
  - [x] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
This commit is contained in:
Andrey 2018-07-13 13:24:51 +03:00 committed by GitHub
parent b6ca03ce47
commit c2fe0d0120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 107 additions and 57 deletions

View file

@ -67,6 +67,18 @@ def test_async_add_job_add_threaded_job_to_pool(mock_iscoro):
assert len(hass.loop.run_in_executor.mock_calls) == 1
@patch('asyncio.iscoroutine', return_value=True)
def test_async_create_task_schedule_coroutine(mock_iscoro):
"""Test that we schedule coroutines and add jobs to the job pool."""
hass = MagicMock()
job = MagicMock()
ha.HomeAssistant.async_create_task(hass, job)
assert len(hass.loop.call_soon.mock_calls) == 0
assert len(hass.loop.create_task.mock_calls) == 1
assert len(hass.add_job.mock_calls) == 0
def test_async_run_job_calls_callback():
"""Test that the callback annotation is respected."""
hass = MagicMock()