Skip to content

Commit

Permalink
Test that CLIs emit no warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Oct 14, 2024
1 parent b76f6db commit 102fd82
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: check-shebang-scripts-are-executable
# - id: check-symlinks
# - id: check-toml
# - id: check-xml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
Expand All @@ -27,6 +27,7 @@ repos:
- id: fix-byte-order-marker
- id: forbid-new-submodules
- id: mixed-line-ending
- id: no-commit-to-branch
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<label>Output intensity in SDA space</label>
<description>Output intensity in SDA space (*.anot)</description>
<channel>output</channel>
<index>2</index>
<index>1</index>
</file>
</parameters>
<parameters advanced="true">
Expand Down
4 changes: 0 additions & 4 deletions histomicstk/cli/SeparateStainsXuSnmf/SeparateStainsXuSnmf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,4 @@
<default>256</default>
</integer>
</parameters>
<parameters>
<label>IO</label>
<description>Input/output parameters.</description>
</parameters>
</executable>
19 changes: 19 additions & 0 deletions tests/test_cli_xml.py
Original file line number Diff line number Diff line change
@@ -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'}

0 comments on commit 102fd82

Please sign in to comment.