Fix test coverage, reverting top level import ptvsd (#28118)

This commit is contained in:
Franck Nijhof 2019-10-23 01:13:34 +02:00 committed by Paulus Schoutsen
parent 4700d647b0
commit adb15286b4

View file

@ -8,7 +8,6 @@ from asyncio import Event
import logging
from threading import Thread
import ptvsd
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT
@ -37,6 +36,12 @@ CONFIG_SCHEMA = vol.Schema(
async def async_setup(hass: HomeAssistantType, config: ConfigType):
"""Set up ptvsd debugger."""
# This is a local import, since importing this at the top, will cause
# ptvsd to hook into `sys.settrace`. So does `coverage` to generate
# coverage, resulting in a battle and incomplete code test coverage.
import ptvsd # pylint: disable=import-outside-toplevel
conf = config[DOMAIN]
host = conf[CONF_HOST]
port = conf[CONF_PORT]