From 3fc396a968be0fec16323d6bdec8ce5f117eced8 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Mon, 14 Oct 2024 10:01:43 -0400 Subject: [PATCH] Test that CLIs emit no warnings --- .../SeparateStainsXuSnmf.xml | 4 ---- tests/test_cli_xml.py | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 tests/test_cli_xml.py diff --git a/histomicstk/cli/SeparateStainsXuSnmf/SeparateStainsXuSnmf.xml b/histomicstk/cli/SeparateStainsXuSnmf/SeparateStainsXuSnmf.xml index 68d1d1f32..e11892f5b 100644 --- a/histomicstk/cli/SeparateStainsXuSnmf/SeparateStainsXuSnmf.xml +++ b/histomicstk/cli/SeparateStainsXuSnmf/SeparateStainsXuSnmf.xml @@ -139,8 +139,4 @@ 256 - - - Input/output parameters. - diff --git a/tests/test_cli_xml.py b/tests/test_cli_xml.py new file mode 100644 index 000000000..a1cab8881 --- /dev/null +++ b/tests/test_cli_xml.py @@ -0,0 +1,19 @@ +import os +from pathlib import Path + +import pytest + +cliDir = Path(__file__).parent / '..' / 'histomicstk' / 'cli' +xmlList = { + cli: cliDir / cli / f'{cli}.xml' for cli in os.listdir(cliDir) + if (cliDir / cli).is_dir() and (cliDir / cli / f'{cli}.xml').is_file() +} + + +@pytest.mark.parametrize('cli', xmlList.keys()) +def testXMLParsing(cli, caplog): + import slicer_cli_web + + slicer_cli_web.CLIArgumentParser(xmlList[cli]) + for record in caplog.records: + assert record.levelname not in {'WARNING', 'ERROR'}