summaryrefslogtreecommitdiff
path: root/t/test_functionality.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/test_functionality.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/test_functionality.py')
-rw-r--r--t/test_functionality.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/t/test_functionality.py b/t/test_functionality.py
index 5253534..12bf775 100644
--- a/t/test_functionality.py
+++ b/t/test_functionality.py
@@ -52,6 +52,22 @@ class BasicUsage(utils.AergiaUnitTestCase):
samples = self.Aergia.get_samples()
- print(self.expected_samples(delay * 3))
self.assertFuncContains('b', [self.expected_samples(delay * 3)],
samples)
+
+ # TODO samples from gather all execution time, should we trace this??
+ self.assertFuncContains('a', [self.expected_samples(delay)], samples)
+
+ def test_eager_task(self):
+ delay = 0.2
+
+ async def a():
+ proc = await asyncio.create_subprocess_shell(f'sleep {delay}')
+ await proc.communicate()
+
+ self.Aergia.start()
+ asyncio.run(a())
+ self.Aergia.stop()
+
+ samples = self.Aergia.get_samples()
+ self.assertFuncContains('a', [self.expected_samples(delay)], samples)