From 9082b042e159fbebe54d4683ec87ce0c19403f4b 2014-01-25 00:51:39 From: MinRK Date: 2014-01-25 00:51:39 Subject: [PATCH] Backport PR #4868: Static path fixes more use of the package dir instead of static file dir, and update a previous test patch of mine to work for build and install time tests --- diff --git a/IPython/core/tests/test_display.py b/IPython/core/tests/test_display.py index a68a1ce..67fb620 100644 --- a/IPython/core/tests/test_display.py +++ b/IPython/core/tests/test_display.py @@ -48,7 +48,10 @@ def test_image_filename_defaults(): nt.assert_raises(ValueError, display.Image) nt.assert_raises(ValueError, display.Image, data='this is not an image', format='badformat', embed=True) from IPython.html import DEFAULT_STATIC_FILES_PATH - imgfile = os.path.join(DEFAULT_STATIC_FILES_PATH, 'base/images/ipynblogo.png') + # check boths paths to allow packages to test at build and install time + imgfile = os.path.join(tpath, 'html/static/base/images/ipynblogo.png') + if not os.path.exists(imgfile): + imgfile = os.path.join(DEFAULT_STATIC_FILES_PATH, 'base/images/ipynblogo.png') img = display.Image(filename=imgfile) nt.assert_equal('png', img.format) nt.assert_is_not_none(img._repr_png_()) diff --git a/IPython/nbconvert/transformers/csshtmlheader.py b/IPython/nbconvert/transformers/csshtmlheader.py index 7f33fa9..b31976c 100755 --- a/IPython/nbconvert/transformers/csshtmlheader.py +++ b/IPython/nbconvert/transformers/csshtmlheader.py @@ -88,8 +88,9 @@ class CSSHTMLHeaderTransformer(Transformer): header = [] #Construct path to IPy CSS - sheet_filename = os.path.join(path.get_ipython_package_dir(), - 'html', 'static', 'style', 'style.min.css') + from IPython.html import DEFAULT_STATIC_FILES_PATH + sheet_filename = os.path.join(DEFAULT_STATIC_FILES_PATH, + 'style', 'style.min.css') #Load style CSS file. with io.open(sheet_filename, encoding='utf-8') as file: