(self)
| 7 | |
| 8 | class TestHTTPOutput(unittest.TestCase): |
| 9 | def setUp(self): |
| 10 | self.emissions_data = EmissionsData( |
| 11 | timestamp="2023-01-01T00:00:00", |
| 12 | project_name="test_project", |
| 13 | run_id="test_run_id", |
| 14 | experiment_id="test_experiment_id", |
| 15 | duration=10, |
| 16 | emissions=0.5, |
| 17 | emissions_rate=0.05, |
| 18 | cpu_power=20, |
| 19 | gpu_power=30, |
| 20 | ram_power=5, |
| 21 | cpu_energy=200, |
| 22 | gpu_energy=300, |
| 23 | ram_energy=50, |
| 24 | energy_consumed=550, |
| 25 | water_consumed=0.1, |
| 26 | country_name="Testland", |
| 27 | country_iso_code="TS", |
| 28 | region="Test Region", |
| 29 | cloud_provider="Test Cloud", |
| 30 | cloud_region="test-cloud-1", |
| 31 | os="TestOS", |
| 32 | python_version="3.8", |
| 33 | codecarbon_version="2.0", |
| 34 | cpu_count=4, |
| 35 | cpu_model="Test CPU", |
| 36 | gpu_count=1, |
| 37 | gpu_model="Test GPU", |
| 38 | longitude=0, |
| 39 | latitude=0, |
| 40 | ram_total_size=16, |
| 41 | tracking_mode="machine", |
| 42 | on_cloud="true", |
| 43 | pue=1.5, |
| 44 | wue=0.5, |
| 45 | ) |
| 46 | self.url = "http://test.com/emissions" |
| 47 | self.http_output = HTTPOutput(endpoint_url=self.url) |
| 48 | |
| 49 | @patch( |
| 50 | "codecarbon.output_methods.http.requests.post", |
nothing calls this directly
no test coverage detected