test suite reviews and discussions
 help / color / mirror / Atom feed
From: Dukai Yuan <dukaix.yuan@intel.com>
To: dts@dpdk.org
Cc: Dukai Yuan <dukaix.yuan@intel.com>
Subject: [dts][PATCH V1] tests/telemetry: Optimize the parameter for function json.load
Date: Fri, 26 May 2023 14:08:12 +0000	[thread overview]
Message-ID: <20230526140812.3594754-1-dukaix.yuan@intel.com> (raw)

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 <dukaix.yuan@intel.com>
---
 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


             reply	other threads:[~2023-05-26  6:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26 14:08 Dukai Yuan [this message]
2023-06-07  5:53 ` lijuan.tu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230526140812.3594754-1-dukaix.yuan@intel.com \
    --to=dukaix.yuan@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).