summaryrefslogtreecommitdiff
path: root/t/utils.py
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-07-19 23:22:13 -0600
committerbd <bdunahu@operationnull.com>2025-07-19 23:22:13 -0600
commit0c0af7dd5a9d1c30820b52f8209151f0f2d5610d (patch)
tree018652147dee18477ac89f073ccb31f4d84ee7ef /t/utils.py
parentac55d9ff0b588b91202ccad72ee71e508e33ad08 (diff)
Fix a bug where inactive loops would be indexed (read desc)
Cleaned up Aergia.walk_back_until_loop to only get running event loops. Previously, this manifested as a bug. The asyncio.Process class would fork off a thread, and the event loop would be found in that thread's local variables, even though that thread was not executing that event loop. This would result in get_event_loops containing duplicate values, and affected event loops would be assigned duplicate time
Diffstat (limited to 't/utils.py')
-rw-r--r--t/utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/t/utils.py b/t/utils.py
index fe9db26..5772fac 100644
--- a/t/utils.py
+++ b/t/utils.py
@@ -13,16 +13,17 @@ class AergiaUnitTestCase(unittest.TestCase):
def assertFuncContains(self, func_name, samples_expected, samples):
samples_actual = self.extract_values_by_func(samples,
func_name)
- self.assertTrue(len(samples_expected) == len(samples_actual))
+ self.assertTrue(len(samples_expected) == len(samples_actual),
+ f'{samples_expected} (expected) not length of '
+ f'{samples_actual} (actual)')
s1 = sorted(samples_expected)
s2 = sorted(samples_actual)
for v1, v2 in zip(s1, s2):
self.assertRoughlyEqual(v1, v2)
def assertRoughlyEqual(self, v1, v2):
- print(f'{v1}, {v2}')
a = abs(v1 - v2)
- self.assertTrue(a <= 1)
+ self.assertTrue(a <= 1, f'{v1} (expected) not roughly {v2} (actual)')
def expected_samples(self, total_seconds):
return (total_seconds / self.interval)