Fix Python API mixin modifying the input file

Move configuration involving the input and output files to before the
run stage to allow mixins to change the file names if required
这个提交包含在:
nmannall
2024-11-25 14:55:56 +00:00
父节点 afe87b0c89
当前提交 e4358613df
共有 2 个文件被更改,包括 19 次插入7 次删除

查看文件

@@ -106,7 +106,7 @@ class GprMaxBaseTest(RunOnlyRegressionTest):
model = parameter()
sourcesdir = required
executable = "time -p python -m gprMax --log-level 10 --hide-progress-bars"
executable = "time -p python -m gprMax"
regression_checks = variable(typ.List[RegressionCheck], value=[])
@@ -159,16 +159,29 @@ class GprMaxBaseTest(RunOnlyRegressionTest):
self.prerun_cmds.append(f"source {path_to_pyenv}")
@run_after("init")
def set_file_paths(self):
self.input_file = Path(f"{self.model}.in")
self.output_file = Path(f"{self.model}.h5")
@run_before("run")
def configure_test_run(self):
"""Configure gprMax commandline arguments and plot outputs
Set the input and output files and add postrun commands to plot
the outputs.
"""
self.input_file = f"{self.model}.in"
self.output_file = f"{self.model}.h5"
self.executable_opts = [self.input_file, "-o", self.output_file]
self.keep_files = [self.input_file, self.output_file]
input_file = str(self.input_file)
output_file = str(self.output_file)
self.executable_opts += [
input_file,
"-o",
output_file,
"--log-level",
"10",
"--hide-progress-bars",
]
self.keep_files += [input_file, output_file]
"""
if self.has_receiver_output:

查看文件

@@ -72,11 +72,10 @@ class SnapshotMixin(GprMaxMixin):
class PythonApiMixin(GprMaxMixin):
executable = "time -p python"
@run_after("setup")
def set_python_input_file(self):
"""Input files for API tests will be python files"""
self.executable = "time -p python"
self.input_file = self.input_file.with_suffix(".py")