validate: Fix error on GstTest.copy()

Fixes regression introduced in ba61160d6c,
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5281>
This commit is contained in:
Alicia Boya García 2023-09-05 13:40:51 +02:00 committed by GStreamer Marge Bot
parent f033160ea2
commit 135f859629

View file

@ -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