-
-
Notifications
You must be signed in to change notification settings - Fork 2k
travis fails when remote data option is on in tests #491
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
Conversation
|
Oh, and you can also look at the |
|
I think you explicitly need to specify the encoding as |
|
Or, alternatively, don't decode and search for bytes rather than string, i.e. |
|
oh, tricky... but why would that be different on travis' machines? |
|
I attached code just so travis will actually run as changes happen on this branch - this is not ready to be merged, though. |
|
The default encoding is platform and user-specific. Not sure the details of what Travis is using, but one should never depend on it being the same across different systems. |
|
I think Travis runs on contributed/distributed machines, which would explain this kind of issue (maybe?) |
|
@mdboom - as you can see here I tried a variety of different approaches, and all were unsucessful (see the travis builds for the commits above). Or did I mis-understand what you were suggesting? |
|
@eteq: Sorry I missed your question from a few weeks ago... Let's confirm first that #539 doesn't solve this, and if not, I'll have another look. I think @astrofrog is right that it's probably somehow related. |
|
I managed to reproduce the issue locally! Will see if I can come up with a fix. |
|
I was also able to reproduce locally at the following fixes it for me: If that isn't working for others, maybe Google is serving the page in a different encoding in different contexts? If that's the case, we probably need to be using a different reference URL (perhaps one we control on astropy.org?) |
|
Yeah, I'm in Germany so maybe that's why I get the error. I agree we should just use http://www.astropy.org instead. |
|
By the way, I still have issues even after @mdboom's suggested fix. The error is then: I did a print repr(googlepage.read()) and got: http://pastebin.com/cbqmRiVm It turns out "I'm feeling lucky" in German doesn't decode to UTF8 ;-) Anyway, this is probably a good reason to just switch to using the Astropy website. |
|
Ah now this is interesting - it looks like the issue is that we must already be converting to UTF8 beforehand: which is what's in my string before we try and decode it. Is this a bug? |
|
Quick update - it seems that in this case, urllib is returning output that's already in UTF8, hence the issue I'm seeing. We might want to think of a fix for this, because if we ever put a non-ascii character on e.g. the Astropy homepage, things won't work anymore. Just out of curiosity, why are we calling |
|
I see. Indeed, it looks like Google is serving We may not need the But ideally, we'd do this against a file we include on our website, as Google could change the encoding of their page at any time. (We could also be more robust to that by reading the "Content-Type" header, but as it stands now, Also, we should add a test that downloads a binary file (e.g. a PNG file or something) just to make sure it works. At present it does, but there's enough potentially for accidentally introducing a codec in |
|
I see your points @astrofrog and @mdboom - the main reason I opted for google is that my general theory is that google is probable one of the most "reachable" sites with the best up-time of anywhere. I was trying to avoid the possiblity of the tests failing because google was down instead of a problem with the good. That said, I see your points about the locality issues and I can't think of any other consistent way to deal with it. (@mdboom - I tried the So we could add a (small) page along the lines of |
|
Yes Yes -- I'm all for adding those files at the top level of the website. |
As discussed in #481, turning on the
--remote-dataoption in the tests causes the tests to all fail on travis. This is probably some permissions issue that may or may not be fixable. The error messages can be viewed at https://travis-ci.org/astropy/astropy/builds/3229836