Mercurial > silorider
view tests/mockutil.py @ 53:805c7d768caa
Make feed parser more resilient, add ability to modify html doc.
- Better handle errors found while parsing the html feed.
- Add CSS-selector-based configuration to modify the html feed before parsing
it. This allows using SiloRider with a feed that doesn't have proper
micro-format markup.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 08 Oct 2023 13:52:26 -0700 |
parents | 27543b2e73b9 |
children | b404445082f8 |
line wrap: on
line source
def mock_urllib(m): import urllib.request m.setattr(urllib.request, 'urlretrieve', _patched_urlretrieve) m.setattr(urllib.request, 'urlcleanup', _patched_urlcleanup) return m def _patched_urlretrieve(url): return ('/retrieved/' + url.lstrip('/'), None) def _patched_urlcleanup(): pass