You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it might be a better design choice to have the HTTP client encapsulated within the PyPIServices class, and for it to configure it however it needs. The code itself will also look cleaner:
The duplicated base URLs can be extracted into the configuration for the HTTP client.
With regard to testing, perhaps you could accept a HTTP client factory method rather than accepting the object directly instead. The default factory would be httpx.Client/httpx.AsyncClient, and tests can pass in a mock that would override it to whatever else.
The text was updated successfully, but these errors were encountered:
I think it might be a better design choice to have the HTTP client encapsulated within the
PyPIServices
class, and for it to configure it however it needs. The code itself will also look cleaner:letsbuilda-pypi/src/letsbuilda/pypi/sync_client.py
Lines 34 to 37 in 8b02f30
The duplicated base URLs can be extracted into the configuration for the HTTP client.
With regard to testing, perhaps you could accept a HTTP client factory method rather than accepting the object directly instead. The default factory would be
httpx.Client
/httpx.AsyncClient
, and tests can pass in a mock that would override it to whatever else.The text was updated successfully, but these errors were encountered: