[elbe-devel] [PATCH 1/1] project-finetuning: Replace deprecated function
Benedikt Spranger
b.spranger at linutronix.de
Mon Oct 9 16:43:26 CEST 2023
unit tests in project finetuning fail due to a deprecation warning:
[ERROR]Testsuite.to_file is deprecated. It will be removed in version 2.0.0. Use function to_xml_report_file
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/elbepack/finetuning.py", line 786, in do_prj_finetuning
action.execute_prj(buildenv, target, builddir)
File "/usr/lib/python3/dist-packages/elbepack/finetuning.py", line 737, in execute_prj
TestSuite.to_file(output, tss)
File "/usr/lib/python3/dist-packages/elbepack/junit.py", line 25, in to_file
junit.TestSuite.to_file(f, tss, prettyprint=True)
File "/usr/lib/python3/dist-packages/junit_xml/__init__.py", line 268, in to_file
warnings.warn(
DeprecationWarning: Testsuite.to_file is deprecated. It will be removed in version 2.0.0. Use function to_xml_report_file
Replace the deprecated function.
Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
---
elbepack/junit.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/elbepack/junit.py b/elbepack/junit.py
index bbaf5a82..bedd99ee 100644
--- a/elbepack/junit.py
+++ b/elbepack/junit.py
@@ -5,7 +5,7 @@
import junit_xml as junit
-
+from junit_xml import to_xml_report_file
class TestException(Exception):
pass
@@ -22,7 +22,7 @@ class TestSuite:
@staticmethod
def to_file(output, tss):
with open(output, 'w') as f:
- junit.TestSuite.to_file(f, tss, prettyprint=True)
+ to_xml_report_file(f, tss, prettyprint=True)
@classmethod
def register(cls, tag, register=True):
--
2.42.0
More information about the elbe-devel
mailing list