Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e94d330

Browse files
committed
move ipython-dependent offline tests to test_optional
1 parent 65c984c commit e94d330

File tree

3 files changed

+8
-51
lines changed

3 files changed

+8
-51
lines changed

plotly/tests/test_core/test_offline/__init__.py

Whitespace-only changes.

plotly/tests/test_core/test_offline/test_offline.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

plotly/tests/test_optional/test_offline/test_offline.py

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,21 @@
44
"""
55
from __future__ import absolute_import
66

7-
import os
8-
from nose.plugins.attrib import attr
97
from nose.tools import raises
108
from unittest import TestCase
119

1210
import plotly
13-
from plotly.exceptions import PlotlyError
14-
15-
dummy_js_url = ('https://gist.githubusercontent.com/chriddyp/'
16-
'f40bd33d1eab6f0715dc/raw/'
17-
'24cd2e4e62ceea79e6e790b3a2c94cda63510ede/'
18-
'test.js')
1911

2012

2113
class PlotlyOfflineTestCase(TestCase):
22-
def _remove_plotlyjs(self):
23-
try:
24-
os.remove(plotly.offline.offline.PLOTLY_OFFLINE_BUNDLE)
25-
except OSError:
26-
pass
27-
28-
def test_no_errors_are_raised_when_initializing_offline_mode(self):
29-
self._remove_plotlyjs()
30-
plotly.offline.download_plotlyjs(dummy_js_url)
31-
plotly.offline.init_notebook_mode()
32-
plotly.offline.iplot([{'x': [1, 2, 3]}])
14+
def setUp(self):
15+
plotly.offline.offline.__PLOTLY_OFFLINE_INITIALIZED = False
3316

34-
@attr('slow')
35-
@raises(PlotlyError)
36-
def test_calling_iplot_before_initializing_raises_an_error(self):
37-
self._remove_plotlyjs()
38-
plotly.offline.download_plotlyjs(dummy_js_url)
39-
plotly.offline.iplot([{'x': [1, 2, 3]}])
17+
@raises(plotly.exceptions.PlotlyError)
18+
def test_iplot_doesnt_work_before_you_call_init_notebook_mode(self):
19+
plotly.offline.iplot([{}])
4020

41-
@raises(PlotlyError)
42-
def test_initializing_before_downloading_raises_an_error(self):
43-
self._remove_plotlyjs()
21+
def test_iplot_works_after_you_call_init_notebook_mode(self):
22+
plotly.tools._ipython_imported = True
4423
plotly.offline.init_notebook_mode()
24+
plotly.offline.iplot([{}])

0 commit comments

Comments
 (0)