From 135f859629aa5383dd5aee3dd4cf2b11c46cf5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Tue, 5 Sep 2023 13:40:51 +0200 Subject: [PATCH] validate: Fix error on GstTest.copy() Fixes regression introduced in ba61160d6c6a69104aa0f68370139d745af11484, where running check tests with gst-validate-launcher -f would trigger this exception: AttributeError: 'GstCheckTest' object has no attribute 'reports'. Did you mean: 'reporter'? The member `reports` is meant to be just part of GstValidateTest, but not other subclasses, even though a usage is still found in the base class GstTest in the method test_end(). This patch introduces an override of the methods copy() and test_end() in GstValidateTest so that `reports` is copied and cleared respectively, but only for validate tests. Part-of: --- .../validate/launcher/baseclasses.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-devtools/validate/launcher/baseclasses.py b/subprojects/gst-devtools/validate/launcher/baseclasses.py index 886efa0e4a..1e3b150cd8 100644 --- a/subprojects/gst-devtools/validate/launcher/baseclasses.py +++ b/subprojects/gst-devtools/validate/launcher/baseclasses.py @@ -163,7 +163,6 @@ class Test(Loggable): def copy(self, nth=None): copied_test = copy.copy(self) - copied_test.reports = copy.deepcopy(self.reports) if nth: copied_test.classname += '_it' + str(nth) copied_test._uuid = None @@ -743,10 +742,6 @@ class Test(Loggable): clean_env[n] = self.proc_env.get(n, None) self.proc_env = clean_env - # Don't keep around JSON report objects, they were processed - # in check_results already - self.reports = [] - return self.result @@ -1001,6 +996,11 @@ class GstValidateTest(Test): self.speed = 1.0 self.actions_infos = [] + def copy(self, nth=None): + new_test = super().copy(nth=nth) + new_test.reports = copy.deepcopy(self.reports) + return new_test + def build_arguments(self): super(GstValidateTest, self).build_arguments() if "GST_VALIDATE" in os.environ: @@ -1233,6 +1233,15 @@ class GstValidateTest(Test): result.extend(utils.get_gst_build_valgrind_suppressions()) return result + def test_end(self, retry_on_failures=False): + ret = super().test_end(retry_on_failures=retry_on_failures) + + # Don't keep around JSON report objects, they were processed + # in check_results already + self.reports = [] + + return ret + class VariableFramerateMode(Enum): DISABLED = 1