Lint exclusions (#28655)

* Remove malformed pylint disable markers

* Remove some unused imports

* Remove some unneeded lint exclusions

* Remove more unneeded lint exclusions

* Add specific codes to all noqa's
This commit is contained in:
Ville Skyttä authored and Fabian Affolter committed 2019-11-16 10:22:07 +01:00
1 parent 2aee366a1f
commit d88ca0f5cb
73 files changed
+113 -142

No files matched your search

@@ -14,7 +14,7 @@ from homeassistant.setup import setup_component
from tests.common import get_test_home_assistant, assert_setup_component, mock_service
from tests.components.tts.test_init import mutagen_mock # noqa
from tests.components.tts.test_init import mutagen_mock # noqa: F401
class TestTTSGooglePlatform:
@@ -76,7 +76,7 @@ async def test_step_import(hass, mock_logi_circle): # pylint: disable=W0621
async def test_full_flow_implementation(
hass, mock_logi_circle
): # noqa pylint: disable=W0621
): # pylint: disable=W0621
"""Test registering an implementation and finishing flow works."""
config_flow.register_flow_implementation(
hass,
@@ -154,7 +154,7 @@ async def test_abort_if_already_setup(hass):
)
async def test_abort_if_authorize_fails(
hass, mock_logi_circle, side_effect, error
): # noqa pylint: disable=W0621
): # pylint: disable=W0621
"""Test we abort if authorizing fails."""
flow = init_config_flow(hass)
mock_logi_circle.LogiCircle().authorize.side_effect = side_effect
@@ -206,7 +206,7 @@ async def test_callback_view_rejects_missing_code(hass):
async def test_callback_view_accepts_code(
hass, mock_logi_circle
): # noqa pylint: disable=W0621
): # pylint: disable=W0621
"""Test the auth callback view handles requests with auth code."""
init_config_flow(hass)
view = LogiCircleAuthCallbackView()
+1 -1
View File
@@ -12,7 +12,7 @@ from homeassistant.components.media_player.const import (
from tests.common import get_test_home_assistant, assert_setup_component, mock_service
from tests.components.tts.test_init import mutagen_mock # noqa
from tests.components.tts.test_init import mutagen_mock # noqa: F401
class TestTTSMaryTTSPlatform:
+4 -10
View File
@@ -1,13 +1,11 @@
"""Entity tests for mobile_app."""
# pylint: disable=redefined-outer-name,unused-import
import logging
_LOGGER = logging.getLogger(__name__)
async def test_sensor(
hass, create_registrations, webhook_client
): # noqa: F401, F811, E501
async def test_sensor(hass, create_registrations, webhook_client):
"""Test that sensors can be registered and updated."""
webhook_id = create_registrations[1]["webhook_id"]
webhook_url = "/api/webhook/{}".format(webhook_id)
@@ -67,9 +65,7 @@ async def test_sensor(
assert updated_entity.state == "123"
async def test_sensor_must_register(
hass, create_registrations, webhook_client # noqa: F401, F811, E501
): # noqa: F401, F811, E501
async def test_sensor_must_register(hass, create_registrations, webhook_client):
"""Test that sensors must be registered before updating."""
webhook_id = create_registrations[1]["webhook_id"]
webhook_url = "/api/webhook/{}".format(webhook_id)
@@ -88,9 +84,7 @@ async def test_sensor_must_register(
assert json["battery_state"]["error"]["code"] == "not_registered"
async def test_sensor_id_no_dupes(
hass, create_registrations, webhook_client # noqa: F401, F811, E501
): # noqa: F401, F811, E501
async def test_sensor_id_no_dupes(hass, create_registrations, webhook_client):
"""Test that sensors must have a unique ID."""
webhook_id = create_registrations[1]["webhook_id"]
webhook_url = "/api/webhook/{}".format(webhook_id)
+2 -3
View File
@@ -12,9 +12,8 @@ from .const import REGISTER, RENDER_TEMPLATE
async def test_registration(hass, hass_client):
"""Test that registrations happen."""
try:
# pylint: disable=unused-import
from nacl.secret import SecretBox # noqa: F401
from nacl.encoding import Base64Encoder # noqa: F401
from nacl.secret import SecretBox
from nacl.encoding import Base64Encoder
except (ImportError, OSError):
pytest.skip("libnacl/libsodium is not installed")
return
+6 -11
View File
@@ -1,5 +1,5 @@
"""Webhook tests for mobile_app."""
# pylint: disable=redefined-outer-name,unused-import
import logging
import pytest
@@ -29,9 +29,7 @@ async def test_webhook_handle_render_template(create_registrations, webhook_clie
assert json == {"one": "Hello world"}
async def test_webhook_handle_call_services(
hass, create_registrations, webhook_client
): # noqa: E501 F811
async def test_webhook_handle_call_services(hass, create_registrations, webhook_client):
"""Test that we call services properly."""
calls = async_mock_service(hass, "test", "mobile_app")
@@ -68,9 +66,7 @@ async def test_webhook_handle_fire_event(hass, create_registrations, webhook_cli
assert events[0].data["hello"] == "yo world"
async def test_webhook_update_registration(
webhook_client, hass_client
): # noqa: E501 F811
async def test_webhook_update_registration(webhook_client, hass_client):
"""Test that a we can update an existing registration via webhook."""
authed_api_client = await hass_client()
register_resp = await authed_api_client.post(
@@ -156,7 +152,7 @@ async def test_webhook_handle_get_config(hass, create_registrations, webhook_cli
async def test_webhook_returns_error_incorrect_json(
webhook_client, create_registrations, caplog
): # noqa: E501 F811
):
"""Test that an error is returned when JSON is invalid."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]), data="not json"
@@ -171,9 +167,8 @@ async def test_webhook_returns_error_incorrect_json(
async def test_webhook_handle_decryption(webhook_client, create_registrations):
"""Test that we can encrypt/decrypt properly."""
try:
# pylint: disable=unused-import
from nacl.secret import SecretBox # noqa: F401
from nacl.encoding import Base64Encoder # noqa: F401
from nacl.secret import SecretBox
from nacl.encoding import Base64Encoder
except (ImportError, OSError):
pytest.skip("libnacl/libsodium is not installed")
return
+2 -2
View File
@@ -9,13 +9,13 @@ from homeassistant.components import onboarding
from homeassistant.components.onboarding import const, views
from tests.common import CLIENT_ID, register_auth_provider
from tests.components.met.conftest import mock_weather # noqa
from tests.components.met.conftest import mock_weather # noqa: F401
from . import mock_storage
@pytest.fixture(autouse=True)
def always_mock_weather(mock_weather): # noqa
def always_mock_weather(mock_weather): # noqa: F811
"""Mock the Met weather provider."""
pass
+2 -4
View File
@@ -66,9 +66,7 @@ async def test_abort_if_already_setup(hass):
assert result["reason"] == "already_setup"
async def test_full_flow_implementation(
hass, mock_pypoint
): # noqa pylint: disable=W0621
async def test_full_flow_implementation(hass, mock_pypoint): # pylint: disable=W0621
"""Test registering an implementation and finishing flow works."""
config_flow.register_flow_implementation(hass, "test-other", None, None)
flow = init_config_flow(hass)
@@ -106,7 +104,7 @@ async def test_step_import(hass, mock_pypoint): # pylint: disable=W0621
@pytest.mark.parametrize("is_authorized", [False])
async def test_wrong_code_flow_implementation(
hass, mock_pypoint
): # noqa pylint: disable=W0621
): # pylint: disable=W0621
"""Test wrong code."""
flow = init_config_flow(hass)
+2 -2
View File
@@ -57,7 +57,7 @@ def aioclient_mock():
yield mock_session
async def test_binary_sensor_device(hass, aioclient_mock): # noqa
async def test_binary_sensor_device(hass, aioclient_mock): # noqa: F811
"""Test a binary sensor device."""
config = {
"qwikswitch": {
@@ -86,7 +86,7 @@ async def test_binary_sensor_device(hass, aioclient_mock): # noqa
assert state_obj.state == "off"
async def test_sensor_device(hass, aioclient_mock): # noqa
async def test_sensor_device(hass, aioclient_mock): # noqa: F811
"""Test a sensor device."""
config = {
"qwikswitch": {
+1 -1
View File
@@ -13,7 +13,7 @@ from homeassistant.setup import setup_component
from tests.common import get_test_home_assistant, assert_setup_component, mock_service
from tests.components.tts.test_init import mutagen_mock # noqa
from tests.components.tts.test_init import mutagen_mock # noqa: F401
class TestTTSVoiceRSSPlatform:
+1 -1
View File
@@ -11,7 +11,7 @@ from homeassistant.components.media_player.const import (
)
from tests.common import get_test_home_assistant, assert_setup_component, mock_service
from tests.components.tts.test_init import mutagen_mock # noqa
from tests.components.tts.test_init import mutagen_mock # noqa: F401
class TestTTSYandexPlatform: