Skip to content

Commit 4056162

Browse files
committed
Improve test_pe fixture stability
1 parent a93c9b7 commit 4056162

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/test_parse_pe.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ def pe(request):
1616

1717
pop_proc = request.param
1818
proc = pop_proc()
19-
time.sleep(0.01)
20-
yield proc.peb.modules[2].pe
19+
for i in range(10):
20+
try:
21+
time.sleep(0.1)
22+
yield proc.peb.modules[2].pe
23+
break
24+
except ValueError:
25+
if i == 9:
26+
# Last change failed
27+
raise
28+
continue # PEB.Ldr not ready yet
2129
proc.exit(0)
2230

2331
PE_DOTNET32_DLL_NAME = "test_pe_dotnet32.dll"

0 commit comments

Comments
 (0)