From 003e122808e3af9c594b3d0cc5f10d4702aa4fc8 Mon Sep 17 00:00:00 2001 From: scito Date: Sun, 1 Jan 2023 00:17:27 +0100 Subject: [PATCH] ignore types for stdout.reconfigure --- Dockerfile_only_txt | 2 +- src/extract_otp_secrets.py | 4 ++-- tests/extract_otp_secrets_test.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile_only_txt b/Dockerfile_only_txt index 6561931..f830c18 100644 --- a/Dockerfile_only_txt +++ b/Dockerfile_only_txt @@ -15,7 +15,7 @@ ARG RUN_TESTS=true RUN apk add --no-cache zlib jpeg \ && echo "Arch: $(apk --print-arch)" \ && if [[ "$(apk --print-arch)" == "aarch64" ]]; then apk add --no-cache --virtual .build-deps gcc libc-dev python3-dev py3-setuptools zlib-dev jpeg-dev; fi \ - && pip install --no-cache-dir protobuf qrcode Pillow \ + && pip install --no-cache-dir protobuf qrcode Pillow colorama \ && if [[ "$(apk --print-arch)" == "aarch64" ]]; then apk del .build-deps; fi \ && if [[ "$RUN_TESTS" == "true" ]]; then /extract/run_pytest.sh tests/extract_otp_secrets_test.py -k "not qreader" --relaxed; else echo "Not running tests..."; fi diff --git a/src/extract_otp_secrets.py b/src/extract_otp_secrets.py index b29790c..de466f9 100644 --- a/src/extract_otp_secrets.py +++ b/src/extract_otp_secrets.py @@ -136,8 +136,8 @@ def main(sys_args: list[str]) -> None: sys.stdout.close = lambda: None # type: ignore # set encoding to utf-8, needed for Windows try: - sys.stdout.reconfigure(encoding='utf-8') - sys.stderr.reconfigure(encoding='utf-8') + sys.stdout.reconfigure(encoding='utf-8') # type: ignore + sys.stderr.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 diff --git a/tests/extract_otp_secrets_test.py b/tests/extract_otp_secrets_test.py index 6a566f4..c65ecfc 100644 --- a/tests/extract_otp_secrets_test.py +++ b/tests/extract_otp_secrets_test.py @@ -38,7 +38,7 @@ qreader_available: bool = extract_otp_secrets.qreader_available # Quickfix comment -#@pytest.mark.skipif(sys.platform.startswith("win") or not qreader_available or sys.implementation.name == 'pypy', reason="Quickfix") +# @pytest.mark.skipif(sys.platform.startswith("win") or not qreader_available or sys.implementation.name == 'pypy', reason="Quickfix") def test_extract_stdout(capsys: pytest.CaptureFixture[str]) -> None: