Tests: parameter-agnostic has_pending monkeypatching

Instead of relying on runtime parameter compatibility between
the patched `has_pending` method and `list.pop`, use a proxy
lambda function that accepts arbitrary keyword params.
This commit is contained in:
James Addison
2026-02-02 11:35:10 +00:00
parent b2f868d2fc
commit 3db7c6d804

View File

@@ -91,8 +91,9 @@ class TestCliWithDb:
postcode_mock = async_mock_func_factory(nominatim_db.indexer.indexer.Indexer, postcode_mock = async_mock_func_factory(nominatim_db.indexer.indexer.Indexer,
'index_postcodes') 'index_postcodes')
has_pending_retvals = [True, False]
monkeypatch.setattr(nominatim_db.indexer.indexer.Indexer, 'has_pending', monkeypatch.setattr(nominatim_db.indexer.indexer.Indexer, 'has_pending',
[False, True].pop) lambda *args, **kwargs: has_pending_retvals.pop(0))
assert self.call_nominatim('index', *params) == 0 assert self.call_nominatim('index', *params) == 0