Skip to contentSkip to conversation

oeqa/core/runner: stub addDuration in OETestResult

PATCH New Ross Burton 1 participant 1 message Jun 17, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa/core/runner: stub addDuration in OETestResult

We have a custom TestResult implementation, and Python 3.12 added a new method addDuration() to the TestResult interface. This would be useful to implement correctly, but for now stub it out to silence the warning when running under Python 3.12:

/usr/lib64/python3.12/unittest/case.py:580: RuntimeWarning: TestResult has no addDuration method
warnings.warn("TestResult has no addDuration method",

---
 meta/lib/oeqa/core/runner.py | 4 ++++
 1 file changed, 4 insertions(+)
meta/lib/oeqa/core/runner.py +4 -0
index a86a706bd96..e478931c4e4 100644
@@ -78,6 +78,10 @@ class OETestResult(_TestResult):
                     self.shownmsg.append(test.id())
                     break
 
+    # Python 3.12 added this, stub it out for now
+    def addDuration(self, test, elapsed):
+         pass
+
     def logSummary(self, component, context_msg=''):
         elapsed_time = self.tc._run_end_time - self.tc._run_start_time
         self.tc.logger.info("SUMMARY:")
Signature · 1 line
2.34.1