File: 0004-Update-benchmark-code.patch

package info (click to toggle)
python-pyppmd 1.3.1%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,668 kB
  • sloc: ansic: 5,665; python: 1,611; makefile: 28
file content (42 lines) | stat: -rw-r--r-- 1,691 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Date: Sun, 23 Nov 2025 06:35:22 +0900
Subject: Update benchmark code

---
 tests/conftest.py | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/tests/conftest.py b/tests/conftest.py
index ad820a1..6bda025 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,8 +1,3 @@
-try:
-    import cpuinfo
-except:
-    cpuinfo = None
-
 def pytest_benchmark_update_json(config, benchmarks, output_json):
     """Calculate compression/decompression speed and add as extra_info"""
     for benchmark in output_json["benchmarks"]:
@@ -12,13 +7,10 @@ def pytest_benchmark_update_json(config, benchmarks, output_json):
 
 
 def pytest_benchmark_update_machine_info(config, machine_info):
-    if cpuinfo is not None:
-        cpu_info = cpuinfo.get_cpu_info()
-        brand = cpu_info.get("brand_raw", None)
-        if brand is None:
-            brand = "{} core(s) {} CPU ".format(cpu_info.get("count", "unknown"), cpu_info.get("arch", "unknown"))
-            machine_info["cpu"]["brand"] = brand
-            machine_info["cpu"]["hz_actual_friendly"] = cpu_info.get("hz_actual_friendly", "unknown")
-    else:
-        machine_info["cpu"]["brand"] = "unknown"
-        machine_info["cpu"]["hz_actual_friendly"] = "unknown"
+    import cpuinfo
+    cpu_info = cpuinfo.get_cpu_info()
+    brand = cpu_info.get("brand_raw", None)
+    if brand is None:
+        brand = "{} core(s) {} CPU ".format(cpu_info.get("count", "unknown"), cpu_info.get("arch", "unknown"))
+        machine_info["cpu"]["brand"] = brand
+        machine_info["cpu"]["hz_actual_friendly"] = cpu_info.get("hz_actual_friendly", "unknown")