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

Skip to content

Fix failing test and refact to TestCase. #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 30, 2015
Merged

Fix failing test and refact to TestCase. #238

merged 2 commits into from
Jun 30, 2015

Conversation

theengineear
Copy link
Contributor

Attempting to fix the failing test due to a 409 --> 400 in plotly's /folders endpoint.

@theengineear
Copy link
Contributor Author

@chriddyp once tests are passing again, i'm going to go ahead and merge this into master so you can pull the fix into your offline mode branch.

@theengineear
Copy link
Contributor Author

@chriddyp seems to be a random failure in python 2.6? also, looks like that version isn't supported at all anymore:

DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python.

Is is time to ditch 2.6?! w00t?

@chriddyp
Copy link
Member

huh? did I write that?

Sent from my iPhone

On Jun 28, 2015, at 12:33 PM, Andrew [email protected] wrote:

@chriddyp seems to be a random failure in python 2.6? also, looks like that version isn't supported at all anymore:

DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python.

Is is time to ditch 2.6?! w00t?


Reply to this email directly or view it on GitHub.

@theengineear
Copy link
Contributor Author

Ah, I think it might be related to the crypto stuff?

https://github.com/pyca/cryptography/blob/master/src/cryptography/__init__.py

@chriddyp
Copy link
Member

oh hm.. uh.. I guess we'll have to follow suit? pyca/cryptography@0857894#commitcomment-11225855

try:
py.file_ops.mkdirs(first_folder)
except PlotlyRequestError as e:
self.assertTrue(400 <= e.status_code < 500)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it sort of helpful to know which error code was thrown? I can imagine writing code against a specific error code (e.g. "if conflict, then the folder exists, so don't make a new folder")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i could definitely see that, it's just that i don't think the python library should couple so closely to streambed. this holds for streaming too, we should try and be as transparent about interacting with the plotly apis as possible. i think :)

Also, the 4xx is like "hey, you did something wrong, you'll need to change your code to fix it", which is much different from 5xx, "oops, our bad, you might want to try that again later".

@chriddyp
Copy link
Member

@theengineear did you see this guy?

https://github.com/plotly/python-api/blob/master/plotly/tests/test_optional/test_utils/test_utils.py#L225-L228

======================================================================
FAIL: plotly.tests.test_optional.test_utils.test_utils.test_pandas_json_encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ubuntu/.pyenv/versions/2.6.8/lib/python2.6/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/ubuntu/python-api/plotly/tests/test_optional/test_utils/test_utils.py", line 228, in test_pandas_json_encoding
    pd.NaT, np.NaN, np.Inf]))
  File "/home/ubuntu/.pyenv/versions/2.6.8/lib/python2.6/site-packages/pandas/util/testing.py", line 701, in assert_series_equal
    assert_attr_equal('name', left, right)
  File "/home/ubuntu/.pyenv/versions/2.6.8/lib/python2.6/site-packages/pandas/util/testing.py", line 552, in assert_attr_equal
    assert_equal(left_attr,right_attr,"attr is not equal [{0}]" .format(attr))
  File "/home/ubuntu/.pyenv/versions/2.6.8/lib/python2.6/site-packages/pandas/util/testing.py", line 533, in assert_equal
    assert a == b, "%s: %r != %r" % (msg.format(a,b), a, b)
AssertionError: attr is not equal [name]: 'col 1' != None
def test_pandas_json_encoding():
    j1 = json.dumps(df['col 1'], cls=utils.PlotlyJSONEncoder)
    assert(j1 == '[1, 2, 3, "2014-01-05", null, null, null]')

    # Test that data wasn't mutated
    assert_series_equal(df['col 1'],
                        pd.Series([1, 2, 3, dt(2014, 1, 5),
                                   pd.NaT, np.NaN, np.Inf]))

@theengineear
Copy link
Contributor Author

re: #238 (comment)

yeah, i think that's a python 2.6 thing? i ran all of our tests locally without any failures.

@theengineear
Copy link
Contributor Author

i'd happily deprecate the use of 2.6. supporting 2.7, 3.3, and 3.4 is much simpler. 2.6 is like 7 years old now. perhaps this can be in our change to 1.7?

@theengineear
Copy link
Contributor Author

@chriddyp if you're alright with the 400 <= X < 500, i think this is good to merge, otherwise, we'll need to (a) make a change in streambed or (b) require this to be 400, which might break in the near future since we're working on a lot of api stuff (hint hint, can we keep it as is 😸 ?)

@chriddyp
Copy link
Member

alright, fair enough @theengineear ! but in the future, once the api is out of beta...!

@theengineear
Copy link
Contributor Author

haha, noted --> #240

theengineear added a commit that referenced this pull request Jun 30, 2015
Fix failing test and refact to TestCase.
@theengineear theengineear merged commit 99b8a9b into master Jun 30, 2015
@theengineear theengineear deleted the fix-master branch June 30, 2015 17:30
@chriddyp
Copy link
Member

chriddyp commented Jul 1, 2015

@theengineear - dropped 2.6 support in this commit, as not being able to import ipython was biting me in those tests: 08a8660

@theengineear
Copy link
Contributor Author

@chriddyp , wonderful, i may make a pr to clean up some other things related to this drop then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants