Commit 92ad2c1e authored by Leo Pound Singer's avatar Leo Pound Singer
Browse files

Add monkeypatch to download FITS file from local repo rather than built docs

parent 4c539a84
......@@ -118,9 +118,24 @@ Then you can manually invoke your GCN handler using this Python code:
.. testsetup::
import os
import unittest.mock
import urllib.parse
from urllib.request import urlopen
old_dir = os.getcwd()
def patched_urlopen(url, *args, **kwargs):
parsed_url = urllib.parse.urlparse(url)
dirname, basename = os.path.split(parsed_url.path)
if parsed_url.netloc != '' \
or dirname != '/userguide/_static':
return urlopen(url, *args, **kwargs)
return urlopen('file:{}'.format(basename), 'rb')
patcher = unittest.mock.patch('urllib.request.urlopen', patched_urlopen)
.. testcode::
import lxml.etree
......@@ -158,5 +173,6 @@ Upon running this, you should see:
.. testcleanup::
.. _curl:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment