Skip to content

Commit

Permalink
Merge pull request #123 from nansencenter/converter_no_file_warn
Browse files Browse the repository at this point in the history
Allow Syntool converter to produce no files
  • Loading branch information
aperrin66 authored Nov 21, 2024
2 parents 5255315 + 2c21d5e commit ba84200
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions geospaas_processing/converters/syntool/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ def convert(self, in_file, out_dir, options, **kwargs):
f"Conversion failed with the following message: {error.stderr}") from error
results = self.move_results(tmp_dir, out_dir)
if not results:
raise ConversionError((
"syntool-converter did not produce any file. "
f"stdout: {process.stdout}"
f"stderr: {process.stderr}"))
logger.warning("syntool-converter did not produce any file.\nstdout: %s\nstderr: %s",
process.stdout,process.stderr)
return results

def ingest(self, in_file, out_dir, options, **kwargs):
Expand Down
3 changes: 1 addition & 2 deletions tests/converters/test_syntool_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def test_convert_move_results_error(self):
converter = syntool_converter.SyntoolConverter()
with mock.patch('subprocess.run'), \
mock.patch.object(converter, 'move_results', return_value=[]):
with self.assertLogs(syntool_converter.logger, level=logging.INFO), \
self.assertRaises(converters_base.ConversionError):
with self.assertLogs(syntool_converter.logger, level=logging.WARNING):
converter.convert('/foo.nc', '/bar', ['--baz'])

def test_ingest(self):
Expand Down

0 comments on commit ba84200

Please sign in to comment.