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

Method setUp

tests/test_utilization_tracking.py:21–34  ·  view source on GitHub ↗

Set up test fixtures.

(self)

Source from the content-addressed store, hash-verified

19 """Test suite for CPU and RAM utilization tracking features."""
20
21 def setUp(self) -> None:
22 """Set up test fixtures."""
23 import tempfile
24
25 self.temp_dir = tempfile.TemporaryDirectory()
26 self.temp_path = Path(self.temp_dir.name)
27 self.emissions_file_path = self.temp_path / "emissions.csv"
28
29 # Patch config file access
30 patcher = mock.patch(
31 "builtins.open", new_callable=get_custom_mock_open(empty_conf, empty_conf)
32 )
33 self.addCleanup(patcher.stop)
34 patcher.start()
35
36 def tearDown(self) -> None:
37 """Clean up test fixtures."""

Callers

nothing calls this directly

Calls 2

get_custom_mock_openFunction · 0.90
startMethod · 0.45

Tested by

no test coverage detected