Remove deprecated PTVSD integration (#44748)
This commit is contained in:
parent
65cf2fcb6f
commit
508d33a220
9 changed files with 1 additions and 135 deletions
|
@ -703,7 +703,6 @@ omit =
|
|||
homeassistant/components/prowl/notify.py
|
||||
homeassistant/components/proxmoxve/*
|
||||
homeassistant/components/proxy/camera.py
|
||||
homeassistant/components/ptvsd/*
|
||||
homeassistant/components/pulseaudio_loopback/switch.py
|
||||
homeassistant/components/pushbullet/notify.py
|
||||
homeassistant/components/pushbullet/sensor.py
|
||||
|
|
|
@ -352,7 +352,6 @@ homeassistant/components/progettihwsw/* @ardaseremet
|
|||
homeassistant/components/prometheus/* @knyar
|
||||
homeassistant/components/proxmoxve/* @k4ds3 @jhollowe
|
||||
homeassistant/components/ps4/* @ktnrg45
|
||||
homeassistant/components/ptvsd/* @swamp-ig
|
||||
homeassistant/components/push/* @dgomes
|
||||
homeassistant/components/pvoutput/* @fabaff
|
||||
homeassistant/components/pvpc_hourly_pricing/* @azogue
|
||||
|
|
|
@ -48,7 +48,7 @@ COOLDOWN_TIME = 60
|
|||
|
||||
MAX_LOAD_CONCURRENTLY = 6
|
||||
|
||||
DEBUGGER_INTEGRATIONS = {"debugpy", "ptvsd"}
|
||||
DEBUGGER_INTEGRATIONS = {"debugpy"}
|
||||
CORE_INTEGRATIONS = ("homeassistant", "persistent_notification")
|
||||
LOGGING_INTEGRATIONS = {
|
||||
# Set log levels
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
"""
|
||||
Enable ptvsd debugger to attach to HA.
|
||||
|
||||
Attach ptvsd debugger by default to port 5678.
|
||||
"""
|
||||
|
||||
from asyncio import Event
|
||||
import logging
|
||||
from threading import Thread
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
|
||||
DOMAIN = "ptvsd"
|
||||
|
||||
CONF_WAIT = "wait"
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
DOMAIN: vol.Schema(
|
||||
{
|
||||
vol.Optional(CONF_HOST, default="0.0.0.0"): cv.string,
|
||||
vol.Optional(CONF_PORT, default=5678): cv.port,
|
||||
vol.Optional(CONF_WAIT, default=False): cv.boolean,
|
||||
}
|
||||
)
|
||||
},
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType):
|
||||
"""Set up ptvsd debugger."""
|
||||
_LOGGER.warning(
|
||||
"ptvsd is deprecated and will be removed in Home Assistant Core 0.120."
|
||||
"The debugpy integration can be used as a full replacement for ptvsd"
|
||||
)
|
||||
|
||||
# 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]
|
||||
|
||||
ptvsd.enable_attach((host, port))
|
||||
|
||||
wait = conf[CONF_WAIT]
|
||||
if wait:
|
||||
_LOGGER.warning("Waiting for ptvsd connection on %s:%s", host, port)
|
||||
ready = Event()
|
||||
|
||||
def waitfor():
|
||||
ptvsd.wait_for_attach()
|
||||
hass.loop.call_soon_threadsafe(ready.set)
|
||||
|
||||
Thread(target=waitfor).start()
|
||||
|
||||
await ready.wait()
|
||||
else:
|
||||
_LOGGER.warning("Listening for ptvsd connection on %s:%s", host, port)
|
||||
|
||||
return True
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"domain": "ptvsd",
|
||||
"name": "PTVSD - Python Tools for Visual Studio Debug Server",
|
||||
"documentation": "https://www.home-assistant.io/integrations/ptvsd",
|
||||
"requirements": ["ptvsd==4.3.2"],
|
||||
"codeowners": ["@swamp-ig"]
|
||||
}
|
|
@ -1170,9 +1170,6 @@ proxmoxer==1.1.1
|
|||
# homeassistant.components.systemmonitor
|
||||
psutil==5.8.0
|
||||
|
||||
# homeassistant.components.ptvsd
|
||||
ptvsd==4.3.2
|
||||
|
||||
# homeassistant.components.wink
|
||||
pubnubsub-handler==1.0.9
|
||||
|
||||
|
|
|
@ -587,9 +587,6 @@ progettihwsw==0.1.1
|
|||
# homeassistant.components.prometheus
|
||||
prometheus_client==0.7.1
|
||||
|
||||
# homeassistant.components.ptvsd
|
||||
ptvsd==4.3.2
|
||||
|
||||
# homeassistant.components.androidtv
|
||||
pure-python-adb[async]==0.3.0.dev0
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
"""Tests for PTVSD Debugger"""
|
|
@ -1,48 +0,0 @@
|
|||
"""Tests for PTVSD Debugger."""
|
||||
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from homeassistant.bootstrap import _async_set_up_integrations
|
||||
import homeassistant.components.ptvsd as ptvsd_component
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
@mark.skip("causes code cover to fail")
|
||||
async def test_ptvsd(hass):
|
||||
"""Test loading ptvsd component."""
|
||||
with patch("ptvsd.enable_attach") as attach:
|
||||
with patch("ptvsd.wait_for_attach") as wait:
|
||||
assert await async_setup_component(
|
||||
hass, ptvsd_component.DOMAIN, {ptvsd_component.DOMAIN: {}}
|
||||
)
|
||||
|
||||
attach.assert_called_once_with(("0.0.0.0", 5678))
|
||||
assert wait.call_count == 0
|
||||
|
||||
|
||||
@mark.skip("causes code cover to fail")
|
||||
async def test_ptvsd_wait(hass):
|
||||
"""Test loading ptvsd component with wait."""
|
||||
with patch("ptvsd.enable_attach") as attach:
|
||||
with patch("ptvsd.wait_for_attach") as wait:
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
ptvsd_component.DOMAIN,
|
||||
{ptvsd_component.DOMAIN: {ptvsd_component.CONF_WAIT: True}},
|
||||
)
|
||||
|
||||
attach.assert_called_once_with(("0.0.0.0", 5678))
|
||||
assert wait.call_count == 1
|
||||
|
||||
|
||||
async def test_ptvsd_bootstrap(hass):
|
||||
"""Test loading ptvsd component with wait."""
|
||||
config = {ptvsd_component.DOMAIN: {ptvsd_component.CONF_WAIT: True}}
|
||||
|
||||
with patch("homeassistant.components.ptvsd.async_setup", AsyncMock()) as setup_mock:
|
||||
setup_mock.return_value = True
|
||||
await _async_set_up_integrations(hass, config)
|
||||
|
||||
assert setup_mock.call_count == 1
|
Loading…
Add table
Reference in a new issue