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

Method test_decorator_flush

tests/test_custom_handler.py:47–63  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

45 self.verify_custom_handler_state(handler_1)
46
47 def test_decorator_flush(self):
48 handler_0 = CustomOutput()
49 handler_1 = CustomOutput()
50
51 @track_emissions(
52 project_name=self.project_name,
53 save_to_logger=True,
54 output_handlers=[handler_0, handler_1],
55 api_call_interval=1,
56 )
57 def dummy_train_model():
58 heavy_computation(run_time_secs=1)
59 return 42
60
61 dummy_train_model()
62 self.verify_custom_handler_state(handler_0)
63 self.verify_custom_handler_state(handler_1)
64
65 def verify_custom_handler_state(
66 self, handler: CustomOutput, expected_lines=1

Callers

nothing calls this directly

Calls 2

CustomOutputClass · 0.85

Tested by

no test coverage detected