From 20cbecec997226694c0d47c105c363d14511e4e9 Mon Sep 17 00:00:00 2001 From: Richard <42204099+rikroe@users.noreply.github.com> Date: Sat, 7 Mar 2026 17:41:55 +0100 Subject: [PATCH] Add error message to code --- bimmer_connected/account.py | 2 ++ bimmer_connected/tests/test_account.py | 2 +- bimmer_connected/tests/test_cli.py | 8 ++++---- bimmer_connected/tests/test_vehicle_status.py | 6 +++--- pyproject.toml | 1 + 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bimmer_connected/account.py b/bimmer_connected/account.py index 61e88f1..bc65c8d 100644 --- a/bimmer_connected/account.py +++ b/bimmer_connected/account.py @@ -23,6 +23,8 @@ _LOGGER = logging.getLogger(__name__) +_LOGGER.error("'bimmer_connected' is non-functional due to changes in the MyBMW API.") + @dataclass class MyBMWAccount: diff --git a/bimmer_connected/tests/test_account.py b/bimmer_connected/tests/test_account.py index b00d667..d52bd1a 100644 --- a/bimmer_connected/tests/test_account.py +++ b/bimmer_connected/tests/test_account.py @@ -750,7 +750,7 @@ async def test_client_async_only(bmw_fixture: respx.Router): with httpx.Client( auth=MyBMWAuthentication(TEST_USERNAME, TEST_PASSWORD, TEST_REGION, hcaptcha_token=TEST_CAPTCHA) ) as client, pytest.raises(RuntimeError): - client.get("/eadrax-ucs/v1/presentation/oauth/config") + client.get("/eadrax-ucs/v1/presentation/oauth/config") # noqa: ASYNC212 with httpx.Client(auth=MyBMWLoginRetry()) as client, pytest.raises(RuntimeError): client.get("/eadrax-ucs/v1/presentation/oauth/config") diff --git a/bimmer_connected/tests/test_cli.py b/bimmer_connected/tests/test_cli.py index b97acf8..5ef9f81 100644 --- a/bimmer_connected/tests/test_cli.py +++ b/bimmer_connected/tests/test_cli.py @@ -160,7 +160,7 @@ def test_oauth_store_credentials(cli_home_dir: Path, bmw_fixture: respx.Router): assert set(oauth_storage.keys()) == {"access_token", "refresh_token", "gcid", "session_id", "session_id_timestamp"} -@time_machine.travel("2021-11-28 21:28:59 +0000") +@time_machine.travel("2021-11-28 21:28:59+00:00") @pytest.mark.usefixtures("cli_home_dir") def test_oauth_load_credentials(cli_home_dir: Path, bmw_fixture: respx.Router): """Test loading and storing the oauth credentials.""" @@ -196,7 +196,7 @@ def test_oauth_load_credentials(cli_home_dir: Path, bmw_fixture: respx.Router): assert oauth_storage["session_id"] == demo_oauth_data["session_id"] -@time_machine.travel("2021-11-28 21:28:59 +0000") +@time_machine.travel("2021-11-28 21:28:59+00:00") @pytest.mark.usefixtures("cli_home_dir") def test_oauth_load_credentials_old_session_id(cli_home_dir: Path, bmw_fixture: respx.Router): """Test loading and storing the oauth credentials and getting a new session_id.""" @@ -206,7 +206,7 @@ def test_oauth_load_credentials_old_session_id(cli_home_dir: Path, bmw_fixture: "refresh_token": "demo_refresh_token", "gcid": "demo_gcid", "session_id": "demo_session_id", - "session_id_timestamp": 1636838939, # 2021-11-13 21:28:59 +0000 + "session_id_timestamp": 1636838939, # 2021-11-13 21:28:59+00:00 } (cli_home_dir / ".bimmer_connected.json").write_text(json.dumps(demo_oauth_data)) @@ -228,7 +228,7 @@ def test_oauth_load_credentials_old_session_id(cli_home_dir: Path, bmw_fixture: assert oauth_storage["session_id_timestamp"] == pytest.approx(time.time(), abs=5) -@time_machine.travel("2021-11-28 21:28:59 +0000") +@time_machine.travel("2021-11-28 21:28:59+00:00") @pytest.mark.usefixtures("cli_home_dir") def test_oauth_store_credentials_on_error(cli_home_dir: Path, bmw_fixture: respx.Router): """Test loading and storing the oauth credentials, even if a call errors out.""" diff --git a/bimmer_connected/tests/test_vehicle_status.py b/bimmer_connected/tests/test_vehicle_status.py index 1ab3164..a05a6bc 100644 --- a/bimmer_connected/tests/test_vehicle_status.py +++ b/bimmer_connected/tests/test_vehicle_status.py @@ -171,7 +171,7 @@ async def test_range_electric(caplog, bmw_fixture: respx.Router): assert len(get_deprecation_warning_count(caplog)) == 0 -@time_machine.travel("2021-11-28 21:28:59 +0000") +@time_machine.travel("2021-11-28 21:28:59+00:00") @pytest.mark.asyncio async def test_charging_end_time(caplog, bmw_fixture: respx.Router): """Test charging end time.""" @@ -186,7 +186,7 @@ async def test_charging_end_time(caplog, bmw_fixture: respx.Router): assert len(get_deprecation_warning_count(caplog)) == 0 -@time_machine.travel("2021-11-28 17:28:59 +0000") +@time_machine.travel("2021-11-28 17:28:59+00:00") @pytest.mark.asyncio async def test_plugged_in_waiting_for_charge_window(caplog, bmw_fixture: respx.Router): """I01_REX is plugged in but not charging, as its waiting for charging window.""" @@ -477,7 +477,7 @@ async def test_tires(bmw_fixture: respx.Router): assert tires.rear_left.season == 2 -@time_machine.travel("2021-11-28 21:28:59 +0000") +@time_machine.travel("2021-11-28 21:28:59+00:00") @pytest.mark.asyncio async def test_climate(bmw_fixture: respx.Router): """Test climate status.""" diff --git a/pyproject.toml b/pyproject.toml index 7508d47..414b122 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,7 @@ ignore = [ "D100", # Missing docstring in public module "D105", # Missing docstring in magic method "D107", # Missing docstring in `__init__` + "FURB171", # Membership test against single-item container "PLR0913", # Too many arguments in function definition "PLR2004", # Magic value used in comparison "PLW1641", # Object does not implement `__hash__` method