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:
1 parent
2aee366a1f
commit
d88ca0f5cb
73 files changed
+113
-142
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user