MDANSE
MDANSE copied to clipboard
[CI/CD] Add tests for encoding inputs
Currently no automated testing for JSONising structural formats.
At the moment, manual testing shows problems with saving the input parameters in the output files:
File "MDANSE/Framework/Jobs/IJob.py", line 419, in run raise JobError(self, tb) MDANSE.Framework.Jobs.IJob.JobError: Traceback (most recent call last): File "MDANSE/Framework/Jobs/IJob.py", line 412, in run self.finalize() File "MDANSE/Framework/Jobs/AngularCorrelation.py", line 213, in finalize self._outputData.write( File "MDANSE/Framework/OutputVariables/IOutputVariable.py", line 42, in write temp_format.write(basename, self, header, inputs) File "MDANSE/Framework/Formats/MDAFormat.py", line 64, in write HDFFormat.write(filename, data, header, run_instance, extension) File "MDANSE/Framework/Formats/HDFFormat.py", line 97, in write inputs = run_instance.output_configuration() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "MDANSE/Framework/Configurable.py", line 209, in output_configuration result[name] = conf.to_json() ^^^^^^^^^^^^^^ File "MDANSE/Framework/Configurators/IConfigurator.py", line 263, in to_json return self._encoder.encode(self._original_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "[email protected]/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 200, in encode chunks = self.iterencode(o, _one_shot=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "[email protected]/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 258, in iterencode return _iterencode(o, 0) ^^^^^^^^^^^^^^^^^ File "[email protected]/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 180, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type PosixPath is not JSON serializable
Originally posted by @MBartkowiakSTFC in https://github.com/ISISNeutronMuon/MDANSE/issues/646#issuecomment-2634269887