Skip to content

Commit

Permalink
remove print statements from aggregator tests
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Oviedo <[email protected]>
  • Loading branch information
OVI3D0 committed Nov 19, 2024
1 parent dd4f92b commit e0c6eef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
6 changes: 2 additions & 4 deletions osbenchmark/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def build_aggregated_results(self):
}

for task, task_metrics in self.accumulated_results.items():
iterations = self.accumulated_iterations.get(task, 1)
aggregated_task_metrics = self.calculate_weighted_average(task_metrics, task)
op_metric = {
"task": task,
Expand Down Expand Up @@ -201,10 +200,9 @@ def build_aggregated_results(self):

def calculate_weighted_average(self, task_metrics: Dict[str, List[Any]], task_name: str) -> Dict[str, Any]:
weighted_metrics = {}
num_executions = len(next(iter(task_metrics.values())))


# Get iterations for each test execution
iterations_per_execution = [self.accumulated_iterations[test_id][task_name]
iterations_per_execution = [self.accumulated_iterations[test_id][task_name]
for test_id in self.test_executions.keys()]
total_iterations = sum(iterations_per_execution)

Expand Down
9 changes: 0 additions & 9 deletions tests/aggregator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def test_count_iterations_for_each_op(aggregator):
with patch('osbenchmark.workload.load_workload', return_value=mock_workload):
aggregator.count_iterations_for_each_op(mock_test_execution)

print(f"accumulated_iterations: {aggregator.accumulated_iterations}")
assert "test1" in aggregator.accumulated_iterations, "test1 not found in accumulated_iterations"
assert "op1" in aggregator.accumulated_iterations["test1"], "op1 not found in accumulated_iterations for test1"
assert aggregator.accumulated_iterations["test1"]["op1"] == 5
Expand Down Expand Up @@ -159,17 +158,9 @@ def test_aggregate(aggregator):

aggregator.aggregate()

print(f"mock_build called: {mock_build.called}")
print(f"mock_store.store_aggregated_execution called: {mock_store.store_aggregated_execution.called}")

assert mock_build.called, "build_aggregated_results was not called"
mock_store.store_aggregated_execution.assert_called_once_with(mock_aggregated_results)

print(f"ensure_dir called: {mock_ensure_dir.called}")
print(f"ensure_dir call args: {mock_ensure_dir.call_args_list}")
print(f"open called: {mock_file.called}")
print(f"open call args: {mock_file.call_args_list}")

assert mock_store.store_aggregated_execution.called, "store_aggregated_execution was not called"

def test_aggregated_results():
Expand Down

0 comments on commit e0c6eef

Please sign in to comment.