Skip to content

Commit 8507dcc

Browse files
author
benoit-cty
committed
Add unit
1 parent 876ed0f commit 8507dcc

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

codecarbon/core/emissions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def get_private_infra_emissions(self, energy: Energy, geo: GeoMetadata) -> float
145145
)
146146
logger.debug(
147147
"electricitymaps_api.get_emissions: "
148-
+ f"Retrieved emissions for {geo.country_name} using Electricity Maps API :{emissions}"
148+
+ f"Retrieved emissions for {geo.country_name} using Electricity Maps API :{emissions * 1000} g CO2eq"
149149
)
150150
return emissions
151151
except Exception as e:

tests/test_electricitymaps_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ def test_get_emissions_RUNS(self):
3636
assert round(result, 5) == 0.58765
3737

3838
@pytest.mark.integ_test
39+
@unittest.skip("Skip real API call in regular test runs")
3940
def test_get_emissions_with_api_key(self):
4041
"""Test with real API call using provided API key"""
41-
api_key = "c3yk3htAFXuWMsg0CSxV"
42+
api_key = "YOUR_REAL_API_KEY"
4243
result = electricitymaps_api.get_emissions(self._energy, self._geo, api_key)
4344
# Should return a positive emissions value
4445
assert result > 0

0 commit comments

Comments
 (0)