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
Create Google Cloud clients only as required to make it easy to test applications using octue. I recommend reviewing other uses of Google clients too.
Or maybe provide an escape hatch by providing an offline/local mode for tests.
Thanks in advance!
Current state
The clients for different google services are created in the init function. This makes patching very difficult for tests.
I'm monkey-patching this particular one in my tests. This was easier than patching many other functions that use the client when I'm only doing local unit tests.
# Monkey patch the unnecessary credential check in initdefdiagnostics_init(self, cloud_path):
self.cloud_path=cloud_pathself.analysis_id=Noneself.configuration_values=Noneself.configuration_manifest=Noneself.input_values=Noneself.input_manifest=Noneself.questions= []
@cached_propertydefdiagnostic_storage_client_property(self):
returnGoogleCloudStorageClient()
Diagnostics.__init__=diagnostics_initDiagnostics._storage_client=diagnostic_storage_client_property
This is obviously not ideal for a variety of reasons but was easier in my case.
The text was updated successfully, but these errors were encountered:
Feature request
Use Case
Create Google Cloud clients only as required to make it easy to test applications using octue. I recommend reviewing other uses of Google clients too.
Or maybe provide an escape hatch by providing an offline/local mode for tests.
Thanks in advance!
Current state
The clients for different google services are created in the init function. This makes patching very difficult for tests.
I'm monkey-patching this particular one in my tests. This was easier than patching many other functions that use the client when I'm only doing local unit tests.
This is obviously not ideal for a variety of reasons but was easier in my case.
The text was updated successfully, but these errors were encountered: