mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Unignore Ruff PLE, PLW in tests (#114406)
* Unignore Ruff PLE, PLW in tests * fix tests
This commit is contained in:
parent
969b027a46
commit
aec7a67a58
@ -344,7 +344,10 @@ def test_supported_features_string(caplog: pytest.LogCaptureFixture) -> None:
|
||||
State("test.entity_id", "on", {"supported_features": "invalid"}),
|
||||
)
|
||||
assert entity.is_supported() is False
|
||||
assert "Entity test.entity_id contains invalid supported_features value invalid"
|
||||
assert (
|
||||
"Entity test.entity_id contains invalid supported_features value invalid"
|
||||
in caplog.text
|
||||
)
|
||||
|
||||
|
||||
def test_request_data() -> None:
|
||||
|
@ -87,7 +87,7 @@ def test_get_significant_states_minimal_response(hass_history) -> None:
|
||||
entity_states = states[entity_id]
|
||||
for state_idx in range(1, len(entity_states)):
|
||||
input_state = entity_states[state_idx]
|
||||
orig_last_changed = orig_last_changed = json.dumps(
|
||||
orig_last_changed = json.dumps(
|
||||
process_timestamp(input_state.last_changed),
|
||||
cls=JSONEncoder,
|
||||
).replace('"', "")
|
||||
|
@ -96,7 +96,7 @@ def test_get_significant_states_minimal_response(legacy_hass_history) -> None:
|
||||
entity_states = states[entity_id]
|
||||
for state_idx in range(1, len(entity_states)):
|
||||
input_state = entity_states[state_idx]
|
||||
orig_last_changed = orig_last_changed = json.dumps(
|
||||
orig_last_changed = json.dumps(
|
||||
process_timestamp(input_state.last_changed),
|
||||
cls=JSONEncoder,
|
||||
).replace('"', "")
|
||||
|
@ -554,7 +554,7 @@ def test_get_significant_states_minimal_response(
|
||||
entity_states = states[entity_id]
|
||||
for state_idx in range(1, len(entity_states)):
|
||||
input_state = entity_states[state_idx]
|
||||
orig_last_changed = orig_last_changed = json.dumps(
|
||||
orig_last_changed = json.dumps(
|
||||
process_timestamp(input_state.last_changed),
|
||||
cls=JSONEncoder,
|
||||
).replace('"', "")
|
||||
|
@ -328,7 +328,7 @@ def test_get_significant_states_minimal_response(
|
||||
entity_states = states[entity_id]
|
||||
for state_idx in range(1, len(entity_states)):
|
||||
input_state = entity_states[state_idx]
|
||||
orig_last_changed = orig_last_changed = json.dumps(
|
||||
orig_last_changed = json.dumps(
|
||||
process_timestamp(input_state.last_changed),
|
||||
cls=JSONEncoder,
|
||||
).replace('"', "")
|
||||
|
@ -327,7 +327,7 @@ def test_get_significant_states_minimal_response(
|
||||
entity_states = states[entity_id]
|
||||
for state_idx in range(1, len(entity_states)):
|
||||
input_state = entity_states[state_idx]
|
||||
orig_last_changed = orig_last_changed = json.dumps(
|
||||
orig_last_changed = json.dumps(
|
||||
process_timestamp(input_state.last_changed),
|
||||
cls=JSONEncoder,
|
||||
).replace('"', "")
|
||||
|
@ -556,7 +556,7 @@ def test_get_significant_states_minimal_response(
|
||||
entity_states = states[entity_id]
|
||||
for state_idx in range(1, len(entity_states)):
|
||||
input_state = entity_states[state_idx]
|
||||
orig_last_changed = orig_last_changed = json.dumps(
|
||||
orig_last_changed = json.dumps(
|
||||
process_timestamp(input_state.last_changed),
|
||||
cls=JSONEncoder,
|
||||
).replace('"', "")
|
||||
|
@ -754,7 +754,7 @@ async def test_option_flow_preview(
|
||||
"""Test the option flow preview."""
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
input_entities = input_entities = ["one", "two"]
|
||||
input_entities = ["one", "two"]
|
||||
|
||||
# Setup the config entry
|
||||
config_entry = MockConfigEntry(
|
||||
|
@ -48,7 +48,7 @@ def mocked_requests(*args, **kwargs):
|
||||
raise requests.HTTPError(self.status_code)
|
||||
|
||||
data = kwargs.get("data")
|
||||
global FIRST_CALL
|
||||
global FIRST_CALL # noqa: PLW0603
|
||||
|
||||
if data and data.get("username", None) == INVALID_USERNAME:
|
||||
# deliver an invalid token
|
||||
|
@ -2,22 +2,10 @@
|
||||
extend = "../pyproject.toml"
|
||||
|
||||
[lint]
|
||||
extend-select = [
|
||||
"PT001", # Use @pytest.fixture without parentheses
|
||||
"PT002", # Configuration for fixture specified via positional args, use kwargs
|
||||
"PT003", # The scope='function' is implied in @pytest.fixture()
|
||||
"PT006", # Single parameter in parameterize is a string, multiple a tuple
|
||||
"PT013", # Found incorrect pytest import, use simple import pytest instead
|
||||
"PT015", # Assertion always fails, replace with pytest.fail()
|
||||
"PT021", # use yield instead of request.addfinalizer
|
||||
"PT022", # No teardown in fixture, replace useless yield with return
|
||||
]
|
||||
|
||||
extend-ignore = [
|
||||
"PLC", # pylint
|
||||
"PLE", # pylint
|
||||
"PLR", # pylint
|
||||
"PLW", # pylint
|
||||
"B904", # Use raise from to specify exception cause
|
||||
"N815", # Variable {name} in class scope should not be mixedCase
|
||||
]
|
||||
|
@ -13,7 +13,7 @@ ENTITIES = []
|
||||
|
||||
def init(empty=False):
|
||||
"""Initialize the platform with entities."""
|
||||
global ENTITIES
|
||||
global ENTITIES # noqa: PLW0603
|
||||
|
||||
ENTITIES = (
|
||||
[]
|
||||
|
@ -12,7 +12,7 @@ ENTITIES = {}
|
||||
|
||||
def init(empty=False):
|
||||
"""Initialize the platform with entities."""
|
||||
global ENTITIES
|
||||
global ENTITIES # noqa: PLW0603
|
||||
|
||||
ENTITIES = (
|
||||
{}
|
||||
|
@ -13,7 +13,7 @@ ENTITIES = []
|
||||
|
||||
def init(empty=False):
|
||||
"""Initialize the platform with entities."""
|
||||
global ENTITIES
|
||||
global ENTITIES # noqa: PLW0603
|
||||
|
||||
ENTITIES = (
|
||||
[]
|
||||
|
@ -33,7 +33,7 @@ ENTITIES = []
|
||||
|
||||
def init(empty=False):
|
||||
"""Initialize the platform with entities."""
|
||||
global ENTITIES
|
||||
global ENTITIES # noqa: PLW0603
|
||||
ENTITIES = [] if empty else [MockWeather()]
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user