MCPcopy Create free account
hub / github.com/mlco2/codecarbon / setUp

Method setUp

tests/output_methods/metrics/test_logfire.py:12–53  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

10
11class TestLogfireOutput(unittest.TestCase):
12 def setUp(self):
13 self.emissions_data = EmissionsData(
14 timestamp="2023-01-01T00:00:00",
15 project_name="test_project",
16 run_id="test_run_id",
17 experiment_id="test_experiment_id",
18 duration=10,
19 emissions=0.5,
20 emissions_rate=0.05,
21 cpu_power=20,
22 gpu_power=30,
23 ram_power=5,
24 cpu_energy=200,
25 gpu_energy=300,
26 ram_energy=50,
27 energy_consumed=550,
28 water_consumed=0.1,
29 country_name="Testland",
30 country_iso_code="TS",
31 region="Test Region",
32 cloud_provider="Test Cloud",
33 cloud_region="test-cloud-1",
34 os="TestOS",
35 python_version="3.8",
36 codecarbon_version="2.0",
37 cpu_count=4,
38 cpu_model="Test CPU",
39 gpu_count=1,
40 gpu_model="Test GPU",
41 longitude=0,
42 latitude=0,
43 ram_total_size=16,
44 tracking_mode="machine",
45 on_cloud="true",
46 pue=1.5,
47 wue=0.5,
48 )
49
50 self.configure_patcher = patch("logfire.configure")
51 self.mock_configure = self.configure_patcher.start()
52 self.mock_configure.return_value = logfire.configure(send_to_logfire=False)
53 self.addCleanup(self.configure_patcher.stop)
54
55 @patch.dict(sys.modules, {"logfire": None})
56 def test_logfire_import_error(self):

Callers

nothing calls this directly

Calls 2

EmissionsDataClass · 0.90
startMethod · 0.45

Tested by

no test coverage detected