Debian Patches

Status for pyanglianwater/2025.6.0-1

Patch Description Author Forwarded Bugs Origin Last update
fix-two-bugs-in-anglianwater-and-msob2ca.patch Fix two bugs in AnglianWater and MSOB2CAuth
get_tariff_config() crashed with AttributeError when tariff_config had
not been populated (e.g. before create_from_authenticator is called),
because it called .get() on None. Add an early-return guard.

decode_oauth_redirect() returns None when no code is present in the
redirect URI, but send_login_request() tried to unpack the return value
directly, causing a TypeError before the existing "code not found" check
could fire. Store the result first and check for None before unpacking.
Edward Betts <edward@4angle.com> no 2026-03-11
fix-test_auth.py-for-pytest-asyncio-stri.patch Fix test_auth.py for pytest-asyncio strict mode and pytest 9
Mark the auth_instance fixture with @pytest_asyncio.fixture so that
pytest-asyncio strict mode recognises it as an async fixture. Remove
the now-incorrect `await auth_instance` lines that were a workaround for
the missing decorator.

Fix test_send_login_request to supply a redirect URL that contains a
`?code=` parameter so that decode_oauth_redirect can extract it.

Rewrite test_send_request and test_send_request_invalid_account to mock
aiohttp.ClientSession as a full async context manager. The previous
approach patched ClientSession.request with AsyncMock, but the
production code uses `async with session.request(...)` which requires an
async context manager, not a coroutine. Also set next_refresh to a
future time in test_send_request_invalid_account so that
send_refresh_request returns early instead of attempting a real POST
through the now-closed fixture session.
Edward Betts <edward@4angle.com> no 2026-03-11
fix-test_meter.py-correct-fixture-parame.patch Fix test_meter.py: correct fixture parameter and cost assertion
SmartMeter.__init__ takes tariff_config (a callable), not tariff_rate.
Update the smart_meter fixture accordingly.

The expected value for get_yesterday_cost was 0.0 with a misleading
comment about "only one reading". With tariff_rate=0.5 and
consumption=10.0 the correct value is (0.5 / 1000) * 10.0 = 0.005.
Edward Betts <edward@4angle.com> no 2026-03-11
fix-test___init__.py-correct-assertions-.patch Fix test___init__.py: correct assertions and broken mock setup
test_initialization: current_tariff returns "Standard" (the default)
when account_config is empty, not None. current_tariff_service returns
0.0 when tariff_config is None, not None.

test_parse_usages: remove assignment to current_tariff_rate which is a
read-only property and has no setter.

test_get_usages: parse_usages returns the unwrapped records list, not a
dict.

test_create_from_authenticator: the test was passing a tariff keyword
argument that does not exist on create_from_authenticator, and was
mutating AnglianWater.API (a class attribute) instead of patching the
module-level name. Rewrite to patch pyanglianwater.API properly and set
up load_tariff_data / send_request return values so the full code path
can run. Assert _custom_rate and _custom_service rather than the
computed rate/service values (which are overridden by the custom values
anyway).
Edward Betts <edward@4angle.com> no 2026-03-11

All known versions for source package 'pyanglianwater'

Links