view tests/mockutil.py @ 34:8c513e43673d

Add debug information when an entry is found without a URL
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 10 May 2023 16:10:35 -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