Re: [PATCH 06/14] Replace HTTP session mocks with responses
Konstantin Ryabitsev <[email protected]>
| Newsgroups | org.kernel.linux.tools |
|---|---|
| Message-ID | <177611517999.749969.14323430684565098987.b4-review@b4> |
On Fri, 10 Apr 2026 18:37:57 -0400, Tamir Duberstein <[email protected]> wrote: > diff --git a/tests/test_cache.py b/tests/test_cache.py > index b822e7c..2313a6b 100644 > --- a/tests/test_cache.py > +++ b/tests/test_cache.py > @@ -121,109 +121,154 @@ class TestProperties: > [ ... skip 161 lines ... ] > - > - node.get_mbox_by_msgid('[email protected]') > - # tmp_path should be empty since we didn't set cache_dir to it > - assert list(tmp_path.iterdir()) == [] > + with responses.RequestsMock() as rsps: > + """When cache_dir is None, no files are written.""" Nitpick, but I think you meant this as a comment, not a docstring. > [ ... skip 17 lines ... ] > - node._fetch_thread_since('[email protected]', 'dt:20240101..') > - node._fetch_thread_since('[email protected]', 'dt:20240101..') > - # Both calls should hit the network > - assert mock_session.post.call_count == 2 > + with responses.RequestsMock() as rsps: > + """_fetch_thread_since should NOT be cached.""" And here. > [ ... skip 23 lines ... ] > - with pytest.raises(RemoteError): > - node.get_mbox_by_msgid('[email protected]') > - # No cache file should be written > - assert list(tmp_path.glob('*.lore.cache')) == [] > + with responses.RequestsMock() as rsps: > + """Network errors should not be cached.""" And here. :) -- KR