Skip to content

#87 Make latency_ms assertion deterministic by mocking perf_counter - #101

Merged
deyna256 merged 2 commits into
deyna256:mainfrom
sathvik458:fix-deterministic-latency-assertion
Mar 3, 2026
Merged

#87 Make latency_ms assertion deterministic by mocking perf_counter#101
deyna256 merged 2 commits into
deyna256:mainfrom
sathvik458:fix-deterministic-latency-assertion

Conversation

@sathvik458

@sathvik458 sathvik458 commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

This PR makes the latency_ms assertion in test_generate_success_returns_content_and_metrics deterministic.

Previously, the test only asserted metrics.latency_ms > 0 , which always passes because time.perf_counter() was not mocked. This did not verify that latency was computed correctly.

The test now mocks time.perf_counter() to control start and end times, allowing assertion of the exact expected latency value in milliseconds.

All test case passed @deyna256
Resolve #87

@deyna256 deyna256 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sathvik458 thanks!

@deyna256 deyna256 assigned deyna256 and sathvik458 and unassigned deyna256 Mar 3, 2026
@deyna256
deyna256 merged commit d19ac62 into deyna256:main Mar 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

assert metrics.latency_ms > 0 is a non-specific assertion

2 participants