From 160b13fd8a46138f31b9458cb46c54af3af95936 Mon Sep 17 00:00:00 2001 From: bd Date: Tue, 22 Jul 2025 21:01:59 -0600 Subject: Add a lot more tests, finish yappi comparisons --- t/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 't/utils.py') diff --git a/t/utils.py b/t/utils.py index 9d77665..4dde466 100644 --- a/t/utils.py +++ b/t/utils.py @@ -27,6 +27,8 @@ class AergiaUnitTestCase(unittest.TestCase): self.assert_roughly_equal(time_actual, time_expected) def assert_similar_delay(self, func_name, yappi_stats, aergia_samples): + '''Compares the results reported by Aergia for FUNC_NAME + with yappi.''' time_yappi = self.yappi_extract_values_by_func(yappi_stats, func_name) samples_aergia = self.aergia_extract_values_by_func( @@ -36,10 +38,11 @@ class AergiaUnitTestCase(unittest.TestCase): self.assert_roughly_equal(time_aergia, time_yappi) def assert_roughly_equal(self, v1, v2): - '''Throws an exception if values V1 and V2 are not within 0.03 - seconds of each other.''' + '''Throws an exception if values V1 and V2 are not within 0.035 + seconds of each other. This number is influenced by instrumentation + overhead, sampling inconsistency, etc.''' a = abs(v1 - v2) - self.assertTrue(a <= .03, f'{v1} (expected) not roughly {v2} (actual)') + self.assertTrue(a <= .035, f'{v1} (actual) not roughly {v2} (expected)') def aergia_expected_time(self, total_samples): '''Given TOTAL_SAMPLES, returns the total time, using the -- cgit v1.2.3