Skip to content

Commit 1117ba5

Browse files
committed
fix badge generation for test with int IDs.
1 parent 24da941 commit 1117ba5

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

cwltest/utils.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ class CWLTestReport:
6969
"""Encapsulate relevant test result data for a markdown report."""
7070

7171
def __init__(
72-
self, id: str, category: list[str], entry: str, tool: str, job: Optional[str]
72+
self,
73+
id: Union[int, str],
74+
category: list[str],
75+
entry: str,
76+
tool: str,
77+
job: Optional[str],
7378
) -> None:
7479
"""Initialize a CWLTestReport object."""
7580
self.id = id
@@ -199,10 +204,9 @@ def generate_badges(
199204

200205
with open(f"{badgedir}/{t}.md", "w") as out:
201206
print(f"# `{t}` tests", file=out)
202-
203207
print("## List of passed tests", file=out)
204208
for e in npassed[t]:
205-
base = f"[{shortname(e.id)}]({e.entry})"
209+
base = f"[{shortname(str(e.id))}]({e.entry})"
206210
tool = f"[tool]({e.tool})"
207211
if e.job:
208212
arr = [tool, f"[job]({e.job})"]
@@ -213,7 +217,7 @@ def generate_badges(
213217

214218
print("## List of failed tests", file=out)
215219
for e in nfailures[t]:
216-
base = f"[{shortname(e.id)}]({e.entry})"
220+
base = f"[{shortname(str(e.id))}]({e.entry})"
217221
tool = f"[tool]({e.tool})"
218222
if e.job:
219223
arr = [tool, f"[job]({e.job})"]
@@ -224,7 +228,7 @@ def generate_badges(
224228

225229
print("## List of unsupported tests", file=out)
226230
for e in nunsupported[t]:
227-
base = f"[{shortname(e.id)}]({e.entry})"
231+
base = f"[{shortname(str(e.id))}]({e.entry})"
228232
tool = f"[tool]({e.tool})"
229233
if e.job:
230234
arr = [tool, f"[job]({e.job})"]

tests/test_plugin.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,16 @@ def test_badgedir(pytester: pytest.Pytester) -> None:
8686
get_data("tests/test-data/cwltool-conftest.py"), path.parent / "conftest.py"
8787
)
8888
_load_v1_0_dir(path)
89-
assert not os.path.exists("cwl-badges")
89+
badge_path = path.parent / "cwl-badges"
90+
assert not badge_path.exists()
9091
pytester.runpytest(
91-
"-k", "conformance_test_v1.0.cwltest.yml", "--cwl-badgedir", "cwl-badges"
92+
"-k", "conformance_test_v1.0.cwltest.yml", "--cwl-badgedir", str(badge_path)
9293
)
93-
assert os.path.exists("cwl-badges")
94+
assert badge_path.exists()
95+
assert (badge_path / "command_line_tool.json").exists()
96+
assert (badge_path / "command_line_tool.md").exists()
97+
assert (badge_path / "required.json").exists()
98+
assert (badge_path / "required.md").exists()
9499

95100

96101
def test_no_label(pytester: pytest.Pytester) -> None:

0 commit comments

Comments
 (0)