File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed
plotly/tests/test_optional/test_offline Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change 3
3
4
4
"""
5
5
from __future__ import absolute_import
6
- from nose .tools import raises
7
6
from unittest import TestCase
8
7
import os
9
8
10
- from plotly .exceptions import PlotlyOfflineNotFound
11
- import plotly
12
-
13
9
14
10
class PlotlyOfflineTestCase (TestCase ):
15
- @raises (PlotlyOfflineNotFound )
16
11
def test_initializing_before_downloading_raises_an_error (self ):
12
+ # Delete the offline directory importing plotly
13
+ # Requires hardcoding this directory into the test
14
+ # from utils.py because simply importing plotly will set the
15
+ # __PLOTLY_OFFLINE_INITIALIZED flag
16
+ PLOTLY_OFFLINE_DIRECTORY = os .path .expanduser (
17
+ os .path .join (* '~/.plotly/plotlyjs' .split ('/' )))
18
+ PLOTLY_OFFLINE_BUNDLE = os .path .join (PLOTLY_OFFLINE_DIRECTORY ,
19
+ 'plotly-ipython-offline-bundle.js' )
20
+
17
21
try :
18
- os .remove (plotly . offline . offline . PLOTLY_OFFLINE_BUNDLE )
22
+ os .remove (PLOTLY_OFFLINE_BUNDLE )
19
23
except OSError :
20
24
pass
21
25
22
- plotly .offline .iplot ([{'x' : [1 , 2 , 3 ]}])
26
+ from plotly .exceptions import PlotlyOfflineNotFound
27
+ import plotly
28
+
29
+ try :
30
+ plotly .offline .iplot ([{'x' : [1 , 2 , 3 ]}])
31
+ except PlotlyOfflineNotFound :
32
+ pass
33
+ else :
34
+ raise Exception ("PlotlyOfflineNotFound wasn't raised" )
You can’t perform that action at this time.
0 commit comments