`test_archive` does not raise exception on incorrect password
Hello,
I'm using patoolib.test_archive() to verify password-protected archives. When I provide an incorrect password, the function outputs error messages like:
ERROR: Wrong password : [IN]49.36.64.49[fateclan]\some_file.txt
However, it doesn't raise a PatoolError or any other exception, making it challenging to programmatically detect incorrect passwords.
Expected Behavior:
When an incorrect password is supplied, test_archive() should raise an exception (e.g., PatoolError) to allow developers to handle such cases appropriately.
Actual Behavior:
The function logs error messages to stdout/stderr but does not raise any exceptions, even when the password is incorrect.
Steps to Reproduce:
import patoolib
from patoolib.util import PatoolError
try:
patoolib.test_archive("protected.rar", password="wrongpassword", interactive=False)
print("Password is correct.")
except PatoolError as e:
print("Password is incorrect:", e)
In this scenario, even with an incorrect password, no exception is raised.
Environment:
- patool version: [4.0.1]
- Python version: [3.12.10]
Thank you for your work on patool.