Skip to content
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

minor bug fix utils.retrieve_over_http #521

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

stellaprins
Copy link
Contributor

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
While adding a test for utils.retrieve_over_http (see add test_atlas_repr_from_name) I noticed that when there is a connection error and no file in the specified output_file_path exists, the block of code below errors at output_file_path.unlink(), throwing an FileNotFoundError, instead of raising the ConnectionError (which is I think what is desired in this case).

    except requests.exceptions.ConnectionError:
        output_file_path.unlink()
        raise requests.exceptions.ConnectionError(
            f"Could not download file from {url}"
        )

What does this PR do?
sets output_file_path.unlink(missing_ok=True) so that the correct error message is shown in case of an ConnectionError.

References

#518

How has this PR been tested?

Added test_retrieve_over_http_ConnectionError to test_utils.py with XFAIL marker that can be removed after this PR is merged.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

No.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@stellaprins stellaprins requested a review from adamltyson March 7, 2025 16:34
@stellaprins stellaprins marked this pull request as ready for review March 7, 2025 16:34
@stellaprins stellaprins mentioned this pull request Mar 10, 2025
7 tasks
@stellaprins
Copy link
Contributor Author

Failing codecov/patch can be ignored. PR #518 deals with test coverage.

@adamltyson adamltyson merged commit 3b10f15 into main Mar 10, 2025
12 of 13 checks passed
@adamltyson adamltyson deleted the sp/minor-bug-fix-utils-retrieve-over-http branch March 10, 2025 14:39
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