From 496564a605f7fda192f7ca32508567ebedcb6569 Mon Sep 17 00:00:00 2001 From: scito Date: Sat, 31 Dec 2022 20:19:21 +0100 Subject: [PATCH] avoid AttributeError in tests StringIO in tests do not have all attributes, ignore it --- src/extract_otp_secrets.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/extract_otp_secrets.py b/src/extract_otp_secrets.py index bdc5a09..4d414ff 100644 --- a/src/extract_otp_secrets.py +++ b/src/extract_otp_secrets.py @@ -133,7 +133,11 @@ def main(sys_args: list[str]) -> None: # allow to use sys.stdout with with (avoid closing) sys.stdout.close = lambda: None # type: ignore # set encoding to utf-8, needed for Windows - sys.stdout.reconfigure(encoding='utf-8') # type: ignore + try: + sys.stdout.reconfigure(encoding='utf-8') # type: ignore + except AttributeError: # '_io.StringIO' object has no attribute 'reconfigure' + # StringIO in tests do not have all attributes, ignore it + pass args = parse_args(sys_args)