From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E635B42BA7; Fri, 26 May 2023 08:30:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B8AD540DDA; Fri, 26 May 2023 08:30:38 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 442FE40A89 for ; Fri, 26 May 2023 08:30:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685082637; x=1716618637; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=udELSMpVDkWjuAiGujX48b3lLLUZZRAkpyL2ZT5evwk=; b=Cem7sb/Of6xtj5ABPt025YgDPshIm1ydQNYZilTIJj4E4SrInfqY3w9C NZW/sGfDbaXmMfGEoc4/RcOmk8iq0XAzl3kEP2L+fi9eZ2v6HIaTFB+5T QHJhSO2iY9OSgzSrMTYPz0LYlMdwyk05uyuSEpdMxe8o/Qsk6ymjzlnQ5 QS4bwxaPL8XMCBhGlCaheWsKSHh2LpYe9HdXJ2MK3hOqm4Qo0pui3z/7w 84xRrX7c5sj1vjwasxyLhNOVKQ30GhtrUhqFvIrsyBRgJqNV16w3OLSw3 sh6O1wVPHcUSpRFPsFbr82oYtuSNMgDA5/SVIRjNIU0v9D37VXYP6LwLy g==; X-IronPort-AV: E=McAfee;i="6600,9927,10721"; a="343628549" X-IronPort-AV: E=Sophos;i="6.00,193,1681196400"; d="scan'208";a="343628549" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2023 23:30:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10721"; a="708285443" X-IronPort-AV: E=Sophos;i="6.00,193,1681196400"; d="scan'208";a="708285443" Received: from unknown (HELO localhost.localdomain) ([10.239.252.44]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2023 23:30:35 -0700 From: Dukai Yuan To: dts@dpdk.org Cc: Dukai Yuan Subject: [dts][PATCH V1] tests/telemetry: Optimize the parameter for function json.load Date: Fri, 26 May 2023 14:08:12 +0000 Message-Id: <20230526140812.3594754-1-dukaix.yuan@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org In Python 3.10, the json.load() function removed the encoding parameter, because in Python 3, the json module uses UTF-8 encoding by default to process JSON data. As such, the encoding argument is no longer required, and has been removed in Python 3.10. If you need to specify other encoding methods, you can use the encoding parameter in the open() function to specify. Please refer to the Python official documentation for more details. https://docs.python.org/3/library/json.html Signed-off-by: Dukai Yuan --- tests/TestSuite_telemetry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/TestSuite_telemetry.py b/tests/TestSuite_telemetry.py index ca2d74f5..b7593cb7 100644 --- a/tests/TestSuite_telemetry.py +++ b/tests/TestSuite_telemetry.py @@ -270,9 +270,9 @@ class TestTelemetry(TestCase): self.dut.session.copy_file_from(json_file, dst_file) msg = "failed to get {}".format(json_name) self.verify(os.path.exists(dst_file), msg) - with open(dst_file, "r") as fp: + with open(dst_file, "r", encoding="utf-8") as fp: try: - query_data = json.load(fp, encoding="utf-8") + query_data = json.load(fp) except Exception as e: msg = "failed to load metrics json data" self.verify(False, msg) -- 2.31.1