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

Skip to content

Commit 26b1b51

Browse files
committed
fix skipIf python 2.6 test failure.
1 parent 7c3bac6 commit 26b1b51

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

plotly/tests/test_core/test_get_figure/test_get_figure.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
import json
1414

1515
from unittest import TestCase
16-
from unittest import skipIf
16+
17+
version = six.sys.version_info[:2] # need this for conditional testing
1718

1819

1920
# username for tests: 'plotlyimagetest'
@@ -198,12 +199,18 @@ def test_all():
198199

199200
class TestBytesVStrings(TestCase):
200201

201-
@skipIf(not six.PY3, 'Decoding and missing escapes is only seen in PY3')
202-
def test_proper_escaping(self):
203-
un = 'PlotlyImageTest'
204-
ak = '786r5mecv0'
205-
url = "https://plot.ly/~PlotlyImageTest/91/"
206-
py.sign_in(un, ak)
207-
print("getting: https://plot.ly/~PlotlyImageTest/91/")
208-
print("###########################################\n\n")
209-
fig = py.get_figure(url)
202+
# unittest `skipIf` not supported in 2.6
203+
if version < (2, 7) or (2, 7) < version < (3, 3):
204+
pass
205+
else:
206+
from unittest import skipIf
207+
208+
@skipIf(not six.PY3, 'Decoding and missing escapes only seen in PY3')
209+
def test_proper_escaping(self):
210+
un = 'PlotlyImageTest'
211+
ak = '786r5mecv0'
212+
url = "https://plot.ly/~PlotlyImageTest/91/"
213+
py.sign_in(un, ak)
214+
print("getting: https://plot.ly/~PlotlyImageTest/91/")
215+
print("###########################################\n\n")
216+
fig = py.get_figure(url)

0 commit comments

Comments
 (0)