Closed mt-digital closed 8 years ago
@shawncrawley Can you review this?
+1
@hyi and @mjstealey This PR is based on the master branch. Should merge it? I am not sure what it does to the readthedocs site (the documentation site for hs_restclient) when you commit to the master.
+1
@hyi and @mjstealey This is a small change based of off master. I plan to merge it to master soon unless you have concerns. In the future we have to watch out that PRs are created to be merged with 'develop' branch only.
Should fix #9 and #12.
basestring
has been removed in Python 3, with juststr
to replace it (see What's New in Python 3 for details).I ran the tests and also found a problem with the format of downloaded content in Python 3, which has been fixed here.
For a download, I feel the content should still be binary (see line 138 in
hs_restclient/__init__.py
). But in the case of a request for science metadata, this should explicitly be a string (see line 468 inhs_restclient/__init__.py
). Python 3 is more specific when dealing with regular strings vs binary strings.The irregular error is the following:
Many times I see total success in the tests, but the above error pops up seemingly randomly. I tried including
time.sleep(...)
in various places to see if the httmocks needed more time to load up. I think it has something to do with lazy generators in Python 3, but I don't know. In any case, this might be good enough to call this Python 3-compatible. Maybe you'd see how to fix it quick. If not, let me know and I will look into it more to try to get it to pass every time.Tests pass on Python 2 with no sign of this intermittent error in the tests.