From f722a821386f5afbdc6ffc119a7e60a5c4b19c09 Mon Sep 17 00:00:00 2001 From: zhenyu-ms <111329301+zhenyu-ms@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:52:14 +0800 Subject: [PATCH] add newsfrag; some tweaks --- doc/newsfragments/3147_changed.another_json_lib.rst | 1 + tests/functional/testplan/exporters/testing/test_json.py | 7 +++++-- tests/unit/testplan/report/test_testing.py | 4 ---- 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 doc/newsfragments/3147_changed.another_json_lib.rst diff --git a/doc/newsfragments/3147_changed.another_json_lib.rst b/doc/newsfragments/3147_changed.another_json_lib.rst new file mode 100644 index 000000000..5104d1c73 --- /dev/null +++ b/doc/newsfragments/3147_changed.another_json_lib.rst @@ -0,0 +1 @@ +Use a new JSON library ``orjson`` to improve performance when using Python 3.8 or later versions. \ No newline at end of file diff --git a/tests/functional/testplan/exporters/testing/test_json.py b/tests/functional/testplan/exporters/testing/test_json.py index add20878f..f722fe9e2 100644 --- a/tests/functional/testplan/exporters/testing/test_json.py +++ b/tests/functional/testplan/exporters/testing/test_json.py @@ -217,8 +217,11 @@ def test_json_exporter_generating_split_report(runpath): assert assertions["After Start"][0]["type"] == "Log" # special values representation preserved - assert str(assertions["test_special_values"][0]["first"]) == "NaN" - assert str(assertions["test_special_values"][1]["first"]) == "-Infinity" + # NOTE: these values are of type float in old impl, + # NOTE: converted to js repr in cope with json lib change + assert assertions["test_special_values"][0]["first"] == "NaN" + assert assertions["test_special_values"][1]["first"] == "-Infinity" + assert assertions["test_special_values"][1]["second"] == "Infinity" def test_implicit_exporter_initialization(runpath): diff --git a/tests/unit/testplan/report/test_testing.py b/tests/unit/testplan/report/test_testing.py index 77a5949b2..f82cd543f 100644 --- a/tests/unit/testplan/report/test_testing.py +++ b/tests/unit/testplan/report/test_testing.py @@ -1,16 +1,12 @@ -# TODO: move certain tests to tests/unit/testplan/common/report/test_base.py - import functools import json from collections import OrderedDict -from unittest import mock import pytest from boltons.iterutils import get_path from testplan.common import entity from testplan.common.report import ( - BaseReportGroup, ReportCategories, RuntimeStatus, Status,