From 0cef35dae5161bb89992b6d35166bd4cfc65b20d Mon Sep 17 00:00:00 2001 From: nilfm Date: Tue, 13 Jun 2023 10:32:08 +0100 Subject: [PATCH] [VCQ-118] Change unittest.TestCase to MyTestCase where appropriate --- python/test/feature_assembler_test.py | 7 ++++--- python/test/local_explainer_test.py | 9 +++------ python/test/result_test.py | 4 +++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/python/test/feature_assembler_test.py b/python/test/feature_assembler_test.py index ee6f6f72c..7c97c2e5e 100644 --- a/python/test/feature_assembler_test.py +++ b/python/test/feature_assembler_test.py @@ -8,16 +8,17 @@ from vmaf.core.feature_assembler import FeatureAssembler from vmaf.core.feature_extractor import VmafFeatureExtractor, FeatureExtractor, \ MomentFeatureExtractor +from vmaf.tools.misc import MyTestCase from test.testutil import set_default_576_324_videos_for_testing -class FeatureAssemblerTest(unittest.TestCase): +class FeatureAssemblerTest(MyTestCase): def tearDown(self): if hasattr(self, 'fassembler'): self.fassembler.remove_results() - pass + super().tearDown() def test_get_fextractor_subclasses(self): fextractor_subclasses = FeatureExtractor.get_subclasses_recursively() @@ -125,7 +126,7 @@ def test_feature_assembler_selected_atom_feature(self): _ = results[0]['VMAF_feature_adm_score'] -class FeatureAssemblerUnitTest(unittest.TestCase): +class FeatureAssemblerUnitTest(MyTestCase): def test_feature_assembler_get_fextractor_instance(self): ref_path, dis_path, asset, asset_original = set_default_576_324_videos_for_testing() diff --git a/python/test/local_explainer_test.py b/python/test/local_explainer_test.py index fa46dcae3..46a942d47 100644 --- a/python/test/local_explainer_test.py +++ b/python/test/local_explainer_test.py @@ -13,21 +13,18 @@ from vmaf.core.train_test_model import SklearnRandomForestTrainTestModel, \ MomentRandomForestTrainTestModel from vmaf.routine import read_dataset -from vmaf.tools.misc import import_python_file +from vmaf.tools.misc import import_python_file, MyTestCase __copyright__ = "Copyright 2016-2020, Netflix, Inc." __license__ = "BSD+Patent" -class LocalExplainerTest(unittest.TestCase): - - def setUp(self): - pass +class LocalExplainerTest(MyTestCase): def tearDown(self): if hasattr(self, 'runner'): self.runner.remove_results() - pass + super().tearDown() def test_explain_train_test_model(self): diff --git a/python/test/result_test.py b/python/test/result_test.py index 4b863dc26..52dd2e767 100644 --- a/python/test/result_test.py +++ b/python/test/result_test.py @@ -301,9 +301,10 @@ def test_from_xml_from_json_and_aggregation(self): assert combined_result.result_dict[key][len(combined_result.result_dict[key]) - 1] == results[1].result_dict[key][len(results[1].result_dict[key]) - 1] -class ScoreAggregationTest(unittest.TestCase): +class ScoreAggregationTest(MyTestCase): def setUp(self): + super().setUp() ref_path = VmafConfig.test_resource_path("yuv", "checkerboard_1920_1080_10_3_0_0.yuv") dis_path = VmafConfig.test_resource_path("yuv", "checkerboard_1920_1080_10_3_1_0.yuv") @@ -333,6 +334,7 @@ def setUp(self): def tearDown(self): if hasattr(self, 'runner'): self.runner.remove_results() + super().tearDown() def test_to_score_str(self):