From f40effba30267b28dea86205ef17c66d31f4dcb2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 29 Jul 2026 13:43:53 +0530 Subject: [PATCH] ... --- kitty_tests/child.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/kitty_tests/child.py b/kitty_tests/child.py index 921d6c0e7..a56fb5bbf 100644 --- a/kitty_tests/child.py +++ b/kitty_tests/child.py @@ -7,14 +7,16 @@ import subprocess from kitty.child import memory_used_by_process_tree_rooted_at from kitty.constants import is_macos, kitty_exe -from . import BaseTest +from .base import BaseTest class ChildMemoryTest(BaseTest): - def _spawn_allocating_child(self, alloc_bytes: int) -> subprocess.Popen: p = subprocess.Popen( - [kitty_exe(), '+runpy', f'''\ + [ + kitty_exe(), + '+runpy', + f"""\ import sys, time buf = bytearray({alloc_bytes}) for i in range(0, {alloc_bytes}, 4096): @@ -22,7 +24,8 @@ for i in range(0, {alloc_bytes}, 4096): sys.stdout.write("ready\\n") sys.stdout.flush() time.sleep(300) -'''], +""", + ], stdout=subprocess.PIPE, ) line = p.stdout.readline().strip() @@ -55,7 +58,8 @@ time.sleep(300) try: mem = memory_used_by_process_tree_rooted_at(child.pid, check_if_cgroup_root=True) self.assertGreater( - mem, alloc // 2, + mem, + alloc // 2, f'Expected at least {alloc // 2} bytes for a {alloc}-byte allocation, got {mem}', ) finally: @@ -70,7 +74,8 @@ time.sleep(300) mem_child = memory_used_by_process_tree_rooted_at(child.pid, check_if_cgroup_root=True) mem_tree = memory_used_by_process_tree_rooted_at(os.getpid(), check_if_cgroup_root=True) self.assertGreater( - mem_tree, mem_child, + mem_tree, + mem_child, 'Parent tree memory should exceed child-only memory', ) finally: