Fix bug when restoring tests using ReceiverMixin

- 'output_file' is not stored in the run report by reframe. Therefore,
  trying to access 'test_dependency.output_file' where 'test_dependency'
  is a restored test case was returning None and causing an error.
- Instead, created a new function to build an output file path that
  can be reused by the ReceiverMixin class.
这个提交包含在:
Nathan Mannall
2025-06-02 16:29:52 +01:00
父节点 45222e62f4
当前提交 bb8f998b38
共有 2 个文件被更改,包括 17 次插入2 次删除

查看文件

@@ -248,6 +248,20 @@ class GprMaxBaseTest(RunOnlyRegressionTest):
# Set the matplotlib cache to the work filesystem
self.env_vars["MPLCONFIGDIR"] = "${HOME/home/work}/.config/matplotlib"
def build_output_file_path(self, filename: str) -> Path:
"""Build output file Path object from filename.
Using a function to build this allows mixins to reuse or
override it if needed.
Args:
filename: Name of output file with no file extension.
Returns:
Path: Output file Path object
"""
return Path(f"{filename}.h5")
@run_after("init")
def set_file_paths(self):
"""Set default test input and output files.
@@ -256,7 +270,7 @@ class GprMaxBaseTest(RunOnlyRegressionTest):
later in the pipeline.
"""
self.input_file = Path(f"{self.model}.in")
self.output_file = Path(f"{self.model}.h5")
self.output_file = self.build_output_file_path(self.model)
@run_before("run")
def configure_test_run(self):

查看文件

@@ -35,7 +35,8 @@ class ReceiverMixin(GprMaxMixin):
def add_receiver_regression_checks(self):
test_dependency = self.get_test_dependency()
if test_dependency is not None:
reference_file = self.build_reference_filepath(test_dependency.output_file)
output_file = self.build_output_file_path(test_dependency.model)
reference_file = self.build_reference_filepath(output_file)
else:
reference_file = self.build_reference_filepath(self.output_file)