test_decorators: Add *DEFAULT_IN_OUT to all calls where -I/-O required
@@ -37,6 +37,8 @@ def cli_with_ocrd_loglevel(*args, **kwargs): # pylint: disable=unused-ar
def cli_dummy_processor(*args, **kwargs):
return ocrd_cli_wrap_processor(DummyProcessor, *args, **kwargs)
+DEFAULT_IN_OUT = ('-I', 'OCR-D-IMG', '-O', 'OUTPUT')
+
class TestDecorators(TestCase):
def setUp(self):
@@ -44,7 +46,8 @@ class TestDecorators(TestCase):
self.runner = CliRunner()
def test_minimal(self):
- result = self.runner.invoke(cli_with_ocrd_cli_options, [])
+ exit_code, out, err = self.invoke_cli(cli_with_ocrd_cli_options, ['-l', 'DEBUG'])
+ print(out, err)
self.assertEqual(result.exit_code, 0)
def test_loglevel_invalid(self):
@@ -81,14 +84,14 @@ class TestDecorators(TestCase):
def test_processor_run(self):
with copy_of_directory(assets.path_to('SBB0000F29300010000/data')) as tempdir:
with pushd_popd(tempdir):
- result = self.runner.invoke(cli_dummy_processor, ['-p', '{"baz": "forty-two"}', '--mets', 'mets.xml', '-I', 'OCR-D-IMG'])
+ result = self.runner.invoke(cli_dummy_processor, ['-p', '{"baz": "forty-two"}', '--mets', 'mets.xml', *DEFAULT_IN_OUT])
print(result)
self.assertEqual(result.exit_code, 0)
def test_param_merging(self):
json1 = '{"foo": 23, "bar": 100}'
json2 = '{"foo": 42}'
- _, out, _ = self.invoke_cli(cli_param_dumper, ['-p', json1, '-p', json2])
+ _, out, _ = self.invoke_cli(cli_param_dumper, [*DEFAULT_IN_OUT, '-p', json1, '-p', json2])
try:
self.assertEqual(out, '{"foo": 42, "bar": 100}\n')
except AssertionError:
@@ -179,7 +182,7 @@ class TestDecorators(TestCase):
'-p', '{"baz": "forty-two"}',
'-P', 'baz', 'one',
'-P', 'baz', 'two',
- '-I', 'OCR-D-IMG',
+ *DEFAULT_IN_OUT
])
print(result)
self.assertEqual(result.stdout, '{"baz": "two"}\n')
@@ -189,7 +192,7 @@ class TestDecorators(TestCase):
with pushd_popd(tempdir):
result = self.runner.invoke(cli_dummy_processor, [
'-P', 'baz', 'two',
- '-I', 'OCR-D-IMG',
+ *DEFAULT_IN_OUT
])
print(result)
self.assertEqual(result.stdout, '{"baz": "two"}\n')
