Skip to content

Commit 78986ba

Browse files
authored
Test that CLIs emit no warnings (#1138)
1 parent b76f6db commit 78986ba

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
- id: check-shebang-scripts-are-executable
1818
# - id: check-symlinks
1919
# - id: check-toml
20-
# - id: check-xml
20+
- id: check-xml
2121
- id: check-yaml
2222
- id: debug-statements
2323
- id: destroyed-symlinks
@@ -27,6 +27,7 @@ repos:
2727
- id: fix-byte-order-marker
2828
- id: forbid-new-submodules
2929
- id: mixed-line-ending
30+
- id: no-commit-to-branch
3031
- id: trailing-whitespace
3132
- repo: https://github.com/pre-commit/pygrep-hooks
3233
rev: v1.10.0

histomicstk/cli/BackgroundIntensity/BackgroundIntensity.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<label>Output intensity in SDA space</label>
6666
<description>Output intensity in SDA space (*.anot)</description>
6767
<channel>output</channel>
68-
<index>2</index>
68+
<index>1</index>
6969
</file>
7070
</parameters>
7171
<parameters advanced="true">

histomicstk/cli/SeparateStainsXuSnmf/SeparateStainsXuSnmf.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,4 @@
139139
<default>256</default>
140140
</integer>
141141
</parameters>
142-
<parameters>
143-
<label>IO</label>
144-
<description>Input/output parameters.</description>
145-
</parameters>
146142
</executable>

tests/test_cli_xml.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
from pathlib import Path
3+
4+
import pytest
5+
6+
cliDir = Path(__file__).parent / '..' / 'histomicstk' / 'cli'
7+
xmlList = {
8+
cli: cliDir / cli / f'{cli}.xml' for cli in os.listdir(cliDir)
9+
if (cliDir / cli).is_dir() and (cliDir / cli / f'{cli}.xml').is_file()
10+
}
11+
12+
13+
@pytest.mark.parametrize('cli', xmlList.keys())
14+
def testXMLParsing(cli, caplog):
15+
import slicer_cli_web
16+
17+
slicer_cli_web.CLIArgumentParser(xmlList[cli])
18+
for record in caplog.records:
19+
assert record.levelname not in {'WARNING', 'ERROR'}

0 commit comments

Comments
 (0)