From da578e3ee282792d28f197611994e874370b5da1 Mon Sep 17 00:00:00 2001 From: Kara Date: Mon, 21 Jul 2025 08:35:12 +0100 Subject: [PATCH] Fixed pylint issues --- eric-oss-hello-world-python-app/login.py | 4 ++-- eric-oss-hello-world-python-app/tests/test_login.py | 2 ++ eric-oss-hello-world-python-app/tests/test_mtls_logging.py | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eric-oss-hello-world-python-app/login.py b/eric-oss-hello-world-python-app/login.py index 4da2e89..9e100a7 100644 --- a/eric-oss-hello-world-python-app/login.py +++ b/eric-oss-hello-world-python-app/login.py @@ -51,10 +51,10 @@ def tls_login(url, headers): cert = (app_cert, app_key) try: - with open(client_id_path, "r") as f: + with open(client_id_path, "r", encoding="utf-8") as f: form_data["client_id"] = f.read().strip() except OSError as e: - raise LoginError(f"Error while reading client id: {e}") + raise LoginError(f"Error while reading client id: {e}") from e try: response = requests.post( diff --git a/eric-oss-hello-world-python-app/tests/test_login.py b/eric-oss-hello-world-python-app/tests/test_login.py index 6b0ffab..be0a91d 100644 --- a/eric-oss-hello-world-python-app/tests/test_login.py +++ b/eric-oss-hello-world-python-app/tests/test_login.py @@ -4,7 +4,9 @@ from login import login, LoginError import pytest + def test_login_receives_token_x509(mock_login_api, config): + # pylint: disable=unused-argument """Check if we receive a token""" token, expiry = login() assert token == "2YotnFZFEjr1zCsicMWpAA" and expiry > time.time() diff --git a/eric-oss-hello-world-python-app/tests/test_mtls_logging.py b/eric-oss-hello-world-python-app/tests/test_mtls_logging.py index ef1a473..ec8db23 100644 --- a/eric-oss-hello-world-python-app/tests/test_mtls_logging.py +++ b/eric-oss-hello-world-python-app/tests/test_mtls_logging.py @@ -1,6 +1,5 @@ """Tests which cover the app's logging, both to STDOUT and to Log Aggregator""" -import builtins import json from unittest import mock import requests