Skip to content

TST: Fix parallel data download test - #7575

Merged
pllim merged 2 commits into
astropy:masterfrom
pllim:fix-data-parallel-test
Jun 21, 2018
Merged

pllim merged 2 commits into
astropy:masterfrom
pllim:fix-data-parallel-test

Conversation

@pllim

@pllim pllim commented Jun 18, 2018 •

Copy link
Copy Markdown
Member

Fix #7573

Close #6061

TODO:

@astropy-bot

astropy-bot Bot commented Jun 18, 2018 •

Copy link
Copy Markdown

Hi there @pllim 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃.

Everything looks good from my point of view! 👍

If there are any issues with this message, please report them here.

@astrofrog astrofrog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, but just one small comment below

Comment thread astropy/utils/tests/test_data.py Outdated
(mirror_url in c_urls) and (main_url not in c_urls))
# Only test the rest if main URL did not timed out
if main_alive:
download_file(mirror_url, cache=True) # Cache mirror copy as well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if the main server is up but the mirror isn't? Won't this fail?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes. I also thought about moving mirror test out into a separate function, but that does not solve the "test failing when main/mirror fail" problem; something is still going to fail but just not this function.

I thought about marking as xfail when things fail here but that defeats the purpose of the test, no? I guess, we should step back and ask... what do we really want to test. Shall we use mock if we don't want to ever deal with flaky main/mirror URLs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess this relates to the unit test x integration test discussion, right? If the scope of the test is just to be an unit test, in my perspective it should use mock to avoid reaching external sources. You should be able to test if the method tries to reach mirror/cache using mocks.

@pllim

pllim commented Jun 19, 2018

Copy link
Copy Markdown
Member Author

@astrofrog , I split the tests and refactored part of it to not require network access. What do you think now?

@pllim

pllim commented Jun 21, 2018

Copy link
Copy Markdown
Member Author

OK merging now. I'll submit a v2.x backport shortly. Thanks!

@pllim
pllim merged commit 5046a36 into astropy:master Jun 21, 2018
@pllim
pllim deleted the fix-data-parallel-test branch June 21, 2018 16:52
bsipocz pushed a commit that referenced this pull request Jun 22, 2018
TST: Fix parallel data download test
@bsipocz bsipocz modified the milestones: v3.0.4, v2.0.8 Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants