Skip to content

Commit fdc1c09

Browse files
committed
test: use monkeypatch instead of patch.dict for clearing environment variables
1 parent e149152 commit fdc1c09

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/test_services/test_satellite_data.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,11 @@ def test_download_sentinel_data_search_error(mock_client, mock_oauth, mock_geojs
221221
# Assertions
222222
assert len(result) == 0
223223

224-
@patch.dict(os.environ, {})
225-
def test_download_sentinel_data_missing_credentials(mock_geojson_point, tmp_path):
224+
def test_download_sentinel_data_missing_credentials(mock_geojson_point, tmp_path, monkeypatch):
225+
# Explicitly remove the environment variables
226+
monkeypatch.delenv('COPERNICUS_CLIENT_ID', raising=False)
227+
monkeypatch.delenv('COPERNICUS_CLIENT_SECRET', raising=False)
228+
226229
# Call the function with missing credentials
227230
output_dir = str(tmp_path)
228231

0 commit comments

Comments
 (0)