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

Cleanup hydroshare provider and stop using urlopen #1393

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yuvipanda
Copy link
Collaborator

@yuvipanda yuvipanda commented Dec 21, 2024

Sort-of a follow up to #993.
Follow-up to #1390, in moving hydroshare tests to be integration tests

It does two things, that are intertwined:

Cleanup using urlopen vs requests

We were:

  1. In some cases, directly using requests
  2. In some cases, directly using the stdlib's urlopen
  3. In some cases, had a method named urlopen that simply passed things through to requests

This is unnecessarily confusing, and seems to primarily be done for the benefit of mocking the network calls. However, as described in the recently merged #1390, I don't think mocking is appropriate here as it means we don't actually catch problems.

This PR mostly focuses on getting unifying to only using requests directly with as little indirection as possible.

Cleanup hydroshare

The biggest user of the slightly easier mocking provided by the url redirection was hydroshare. Similar to #1390, this PR now:

  1. Turns the hydroshare tests into integration tests
  2. Simplifies the detection logic and makes it clearer what we are detecting (with URL examples in the tests)

We were:

1. In some cases, directly using requests
2. In some cases, directly using the stdlib's urlopen
3. In some cases, had a method named urlopen that simply passed
   things through to requests

This is unnecessarily confusing, and seems to primarily be done
for the benefit of mocking the network calls. However, as described
in the recently merged jupyterhub#1390,
I don't think mocking is appropriate here as it means we don't actually
catch problems.

This PR mostly focuses on getting unifying to only using requests
directly with as little indirection as possible. If any tests were
directly using mocks here, they will be replaced with something that
is testing things more directly as appropriate
@yuvipanda yuvipanda marked this pull request as draft December 21, 2024 00:00
- Cleanup how the provider is detected, as we were simply doing
  a domain check but with many extra steps
- Move the tests to be real integration tests
- Test detection, not content_id
@yuvipanda yuvipanda changed the title Only use requests, not a mix of requests & urlopen Cleanup hydroshare provider and stop using urlopen Dec 21, 2024
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.

1 participant