diff --git a/.coveragerc b/.coveragerc index ccbdaa9c6fa..1fdabeff103 100644 --- a/.coveragerc +++ b/.coveragerc @@ -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 diff --git a/CODEOWNERS b/CODEOWNERS index 7b874bb0ebf..1ec8f6f30f1 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -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 diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index b68fc9d17ac..ff8ecfa0070 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -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 diff --git a/homeassistant/components/ptvsd/__init__.py b/homeassistant/components/ptvsd/__init__.py deleted file mode 100644 index 258589084a0..00000000000 --- a/homeassistant/components/ptvsd/__init__.py +++ /dev/null @@ -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 diff --git a/homeassistant/components/ptvsd/manifest.json b/homeassistant/components/ptvsd/manifest.json deleted file mode 100644 index 5feb04e92bb..00000000000 --- a/homeassistant/components/ptvsd/manifest.json +++ /dev/null @@ -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"] -} diff --git a/requirements_all.txt b/requirements_all.txt index 940d2b96a89..4bef886080d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index c7da734d3e9..6585308074a 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -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 diff --git a/tests/components/ptvsd/__init__py b/tests/components/ptvsd/__init__py deleted file mode 100644 index e2a1a9ba0a6..00000000000 --- a/tests/components/ptvsd/__init__py +++ /dev/null @@ -1 +0,0 @@ -"""Tests for PTVSD Debugger""" diff --git a/tests/components/ptvsd/test_ptvsd.py b/tests/components/ptvsd/test_ptvsd.py deleted file mode 100644 index b3e408833dc..00000000000 --- a/tests/components/ptvsd/test_ptvsd.py +++ /dev/null @@ -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