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

Manage empty searches in transfer_complete_datasets #204

Merged
merged 11 commits into from
Sep 21, 2022

Conversation

SolarDrew
Copy link
Contributor

Closes #194

In transfer_complete_datasets, if _get_dataset_inventory returns no results (which it might if the ID string is invalid or if the data just aren't available), this catches the error and raises it with an appropriate message.

Comment on lines 73 to 76
try:
datasets = _get_dataset_inventory(datasets)[0]
except IndexError as e:
raise IndexError(f"No results available for dataset {datasets}") from e
Copy link
Member

Choose a reason for hiding this comment

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

If we do this inside _get_dataset_inventory we could avoid the try block which is always my slight preference?

@@ -44,6 +44,17 @@ def test_download_default_keywords(orchestrate_transfer_mock, keywords):
)


def test_transfer_unavailable_data(mocker):
get_inv_mock = mocker.patch(
"dkist.net.client.DKISTClient.search",
Copy link
Member

Choose a reason for hiding this comment

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

Is this mocker actually being hit? I would have thought this should be

Suggested change
"dkist.net.client.DKISTClient.search",
"dkist.net.helpers.DKISTClient.search",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it wasn't, surely the test would hit the "An attempt was made to connect to the internet" error (which is what happens if I take the mocker out entirely).

@SolarDrew
Copy link
Contributor Author

Also it looks like several of the tests are fouling on a MatplotlibDeprecationWarning, but not in tests that I've touched at all so I don't really know why that's happening or how to fix it.

@codecov
Copy link

codecov bot commented Sep 21, 2022

Codecov Report

Merging #204 (bffc700) into main (9172452) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #204   +/-   ##
=======================================
  Coverage   96.41%   96.41%           
=======================================
  Files          29       29           
  Lines        1506     1506           
=======================================
  Hits         1452     1452           
  Misses         54       54           
Impacted Files Coverage Δ
dkist/net/helpers.py 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Cadair Cadair merged commit 6762811 into DKISTDC:main Sep 21, 2022
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.

transfer_complete_datasets fails when given string dataset ids as input
2 participants