From 405616290f8a5285c29b7b1e4a8499c73eee838c Mon Sep 17 00:00:00 2001 From: hakril Date: Sat, 8 Feb 2025 19:44:39 +0100 Subject: [PATCH] Improve test_pe fixture stability --- tests/test_parse_pe.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_parse_pe.py b/tests/test_parse_pe.py index 6fe6c3c..853a891 100644 --- a/tests/test_parse_pe.py +++ b/tests/test_parse_pe.py @@ -16,8 +16,16 @@ def pe(request): pop_proc = request.param proc = pop_proc() - time.sleep(0.01) - yield proc.peb.modules[2].pe + for i in range(10): + try: + time.sleep(0.1) + yield proc.peb.modules[2].pe + break + except ValueError: + if i == 9: + # Last change failed + raise + continue # PEB.Ldr not ready yet proc.exit(0) PE_DOTNET32_DLL_NAME = "test_pe_dotnet32.dll"