Skip to content

Commit

Permalink
Don't require USE_ADC_CREDENTIALS=1 to run tests.
Browse files Browse the repository at this point in the history
Instead use ADC credentials if GOOGLE_APPLICATION_CREDENTIALS does not
exist. This allows tests to be run without setting an environment
variable, which is required by VSCode's Testing (test discovery and
management).
  • Loading branch information
tylere committed Feb 4, 2025
1 parent 548adc8 commit c3f4a3d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions xee/ext_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/earthengine',
]
_USE_ADC_CREDENTIALS_KEY = 'USE_ADC_CREDENTIALS'


def _read_identity_pool_creds() -> identity_pool.Credentials:
Expand All @@ -54,7 +53,7 @@ def init_ee_for_tests():
init_params = {
'opt_url': ee.data.HIGH_VOLUME_API_BASE_URL,
}
if not os.environ.get(_USE_ADC_CREDENTIALS_KEY, False):
if _CREDENTIALS_PATH_KEY in os.environ:
credentials = _read_identity_pool_creds()
init_params['credentials'] = credentials
init_params['project'] = credentials.project_number
Expand Down

0 comments on commit c3f4a3d

Please sign in to comment.