Closed andylolz closed 3 weeks ago
google.auth.default() raises an exception if google credentials aren’t set. When this is called from outside of a function, this exception is raised on module import.
google.auth.default()
See for example: https://github.com/FullFact/health-misinfo-shared/blob/46597a4806e36077ebb331498c21ec000567cc1d/src/health_misinfo_shared/fine_tuning.py#L25
This call means if we want to import fine_tuning, we can only do it successfully if google credentials are set.
import fine_tuning
This causes a problem for unit testing, because if any bit of the code imports this module in a unit test, the unit test will fail.
google.auth.default()
raises an exception if google credentials aren’t set. When this is called from outside of a function, this exception is raised on module import.See for example: https://github.com/FullFact/health-misinfo-shared/blob/46597a4806e36077ebb331498c21ec000567cc1d/src/health_misinfo_shared/fine_tuning.py#L25
This call means if we want to
import fine_tuning
, we can only do it successfully if google credentials are set.This causes a problem for unit testing, because if any bit of the code imports this module in a unit test, the unit test will fail.