Skip to content

Commit df3028f

Browse files
task(req): links missing Platform Module Specification with tests [skip:ci]
1 parent c8cd940 commit df3028f

File tree

2 files changed

+40
-20
lines changed

2 files changed

+40
-20
lines changed

tests/aignostics/application/cli_test.py

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,44 @@
1717
MESSAGE_RUN_NOT_FOUND = "Warning: Run with ID '4711' not found"
1818

1919

20-
def test_cli_application_list(runner: CliRunner) -> None:
20+
def test_cli_application_list(runner: CliRunner, record_property) -> None:
2121
"""Check application list command runs successfully."""
22+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
2223
result = runner.invoke(cli, ["application", "list"])
2324
assert result.exit_code == 0
2425
assert HETA_APPLICATION_ID in normalize_output(result.output)
2526
assert TEST_APPLICATION_ID in normalize_output(result.output)
2627

2728

28-
def test_cli_application_list_verbose(runner: CliRunner) -> None:
29+
def test_cli_application_list_verbose(runner: CliRunner, record_property) -> None:
2930
"""Check application list command runs successfully."""
31+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
3032
result = runner.invoke(cli, ["application", "list", "--verbose"])
3133
assert result.exit_code == 0
3234
assert HETA_APPLICATION_ID in normalize_output(result.output)
3335
assert "Artifacts: 1 input(s), 6 output(s)" in normalize_output(result.output)
3436
assert TEST_APPLICATION_ID in normalize_output(result.output)
3537

3638

37-
def test_cli_application_describe(runner: CliRunner) -> None:
39+
def test_cli_application_describe(runner: CliRunner, record_property) -> None:
3840
"""Check application describe command runs successfully."""
41+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
3942
result = runner.invoke(cli, ["application", "describe", HETA_APPLICATION_ID])
4043
assert result.exit_code == 0
4144
assert "tissue_qc:geojson_polygons" in normalize_output(result.output)
4245

4346

44-
def test_cli_application_describe_not_found(runner: CliRunner) -> None:
47+
def test_cli_application_describe_not_found(runner: CliRunner, record_property) -> None:
4548
"""Check application describe command fails as expected on unknown application."""
49+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
4650
result = runner.invoke(cli, ["application", "describe", "unknown"])
4751
assert result.exit_code == 2
4852
assert "Application with ID 'unknown' not found." in normalize_output(result.output)
4953

5054

51-
def test_cli_application_dump_schemata(runner: CliRunner, tmp_path: Path) -> None:
55+
def test_cli_application_dump_schemata(runner: CliRunner, tmp_path: Path, record_property) -> None:
5256
"""Check application dump schemata works as expected."""
57+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
5358
result = runner.invoke(
5459
cli, ["application", "dump-schemata", HETA_APPLICATION_ID, "--destination", str(tmp_path), "--zip"]
5560
)
@@ -102,8 +107,9 @@ def test_cli_application_run_prepare_upload_submit_fail_on_mpp(
102107
assert "8.065226874391001 is greater than" in normalize_output(result.stdout)
103108

104109

105-
def test_cli_application_run_upload_fails_on_missing_source(runner: CliRunner, tmp_path: Path) -> None:
110+
def test_cli_application_run_upload_fails_on_missing_source(runner: CliRunner, tmp_path: Path, record_property) -> None:
106111
"""Check application run prepare command and upload works and submit fails on mpp not supported."""
112+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
107113
metadata_csv = tmp_path / "metadata.csv"
108114
metadata_csv.write_text(
109115
"reference;checksum_base64_crc32c;resolution_mpp;width_px;height_px;staining_method;tissue;disease;"
@@ -117,8 +123,9 @@ def test_cli_application_run_upload_fails_on_missing_source(runner: CliRunner, t
117123
assert "Warning: Source file 'missing.file' (row 0) does not exist" in normalize_output(result.stdout)
118124

119125

120-
def test_cli_run_submit_fails_on_application_not_found(runner: CliRunner, tmp_path: Path) -> None:
126+
def test_cli_run_submit_fails_on_application_not_found(runner: CliRunner, tmp_path: Path, record_property) -> None:
121127
"""Check run submit command fails as expected."""
128+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
122129
csv_content = "reference;checksum_base64_crc32c;resolution_mpp;width_px;height_px;staining_method;tissue;disease;"
123130
csv_content += "platform_bucket_url\n"
124131
csv_content += ";5onqtA==;0.26268186053789266;7447;7196;H&E;LUNG;LUNG_CANCER;gs://bucket/test"
@@ -131,8 +138,9 @@ def test_cli_run_submit_fails_on_application_not_found(runner: CliRunner, tmp_pa
131138
assert "Error: Failed to create run for application version" in normalize_output(result.stdout)
132139

133140

134-
def test_cli_run_submit_fails_on_unsupported_cloud(runner: CliRunner, tmp_path: Path) -> None:
141+
def test_cli_run_submit_fails_on_unsupported_cloud(runner: CliRunner, tmp_path: Path, record_property) -> None:
135142
"""Check run submit command fails as expected."""
143+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
136144
csv_content = "reference;checksum_base64_crc32c;resolution_mpp;width_px;height_px;staining_method;tissue;disease;"
137145
csv_content += "platform_bucket_url\n"
138146
csv_content += ";5onqtA==;0.26268186053789266;7447;7196;H&E;LUNG;LUNG_CANCER;aws://bucket/test"
@@ -145,8 +153,9 @@ def test_cli_run_submit_fails_on_unsupported_cloud(runner: CliRunner, tmp_path:
145153
assert "Invalid platform bucket URL: 'aws://bucket/test'" in normalize_output(result.stdout)
146154

147155

148-
def test_cli_run_submit_fails_on_missing_url(runner: CliRunner, tmp_path: Path) -> None:
156+
def test_cli_run_submit_fails_on_missing_url(runner: CliRunner, tmp_path: Path, record_property) -> None:
149157
"""Check run submit command fails as expected."""
158+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
150159
csv_content = "reference;checksum_base64_crc32c;resolution_mpp;width_px;height_px;staining_method;tissue;disease;"
151160
csv_content += "platform_bucket_url\n"
152161
csv_content += ";5onqtA==;0.26268186053789266;7447;7196;H&E;LUNG;LUNG_CANCER;"
@@ -232,8 +241,9 @@ def test_cli_run_submit_and_describe_and_cancel_and_download(
232241
assert f"Failed to create destination directory '/4711/{run_id}'" in normalize_output(download_result.stdout)
233242

234243

235-
def test_cli_run_list_limit_10(runner: CliRunner) -> None:
244+
def test_cli_run_list_limit_10(runner: CliRunner, record_property) -> None:
236245
"""Check run list command runs successfully."""
246+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
237247
result = runner.invoke(cli, ["application", "run", "list", "--limit", "10"])
238248
assert result.exit_code == 0
239249
output = normalize_output(result.stdout)
@@ -245,8 +255,9 @@ def test_cli_run_list_limit_10(runner: CliRunner) -> None:
245255
assert displayed_count <= 10, f"Expected listed count to be <= 10, but got {displayed_count}"
246256

247257

248-
def test_cli_run_list_verbose_limit_1(runner: CliRunner) -> None:
258+
def test_cli_run_list_verbose_limit_1(runner: CliRunner, record_property) -> None:
249259
"""Check run list command runs successfully."""
260+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
250261
result = runner.invoke(cli, ["application", "run", "list", "--verbose", "--limit", "1"])
251262
assert result.exit_code == 0
252263
output = normalize_output(result.stdout)
@@ -258,52 +269,59 @@ def test_cli_run_list_verbose_limit_1(runner: CliRunner) -> None:
258269
assert displayed_count == 1, f"Expected listed count to be == 1, but got {displayed_count}"
259270

260271

261-
def test_cli_run_describe_invalid_uuid(runner: CliRunner) -> None:
272+
def test_cli_run_describe_invalid_uuid(runner: CliRunner, record_property) -> None:
262273
"""Check run describe command fails as expected on run not found."""
274+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
263275
result = runner.invoke(cli, ["application", "run", "describe", "4711"])
264276
assert result.exit_code == 1
265277
assert "Error: Failed to retrieve run details for ID '4711'" in normalize_output(result.stdout)
266278

267279

268-
def test_cli_run_describe_not_found(runner: CliRunner) -> None:
280+
def test_cli_run_describe_not_found(runner: CliRunner, record_property) -> None:
269281
"""Check run describe command fails as expected on run not found."""
282+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
270283
result = runner.invoke(cli, ["application", "run", "describe", "00000000000000000000000000000000"])
271284
assert result.exit_code == 2
272285
assert "Warning: Run with ID '00000000000000000000000000000000' not found." in normalize_output(result.stdout)
273286

274287

275-
def test_cli_run_cancel_invalid_run_id(runner: CliRunner) -> None:
288+
def test_cli_run_cancel_invalid_run_id(runner: CliRunner, record_property) -> None:
276289
"""Check run cancel command fails as expected on run not found."""
290+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
277291
result = runner.invoke(cli, ["application", "run", "cancel", "4711"])
278292
assert result.exit_code == 1
279293
assert "Failed to cancel run with ID '4711'" in normalize_output(result.stdout)
280294

281295

282-
def test_cli_run_cancel_not_found(runner: CliRunner) -> None:
296+
def test_cli_run_cancel_not_found(runner: CliRunner, record_property) -> None:
283297
"""Check run cancel command fails as expected on run not found."""
298+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
284299
result = runner.invoke(cli, ["application", "run", "cancel", "00000000000000000000000000000000"])
285300
assert result.exit_code == 2
286301
assert "Warning: Run with ID '00000000000000000000000000000000' not found." in normalize_output(result.stdout)
287302

288303

289-
def test_cli_run_result_download_invalid_uuid(runner: CliRunner, tmp_path: Path) -> None:
304+
def test_cli_run_result_download_invalid_uuid(runner: CliRunner, tmp_path: Path, record_property) -> None:
290305
"""Check run result download command fails on invalid uui."""
306+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
291307
result = runner.invoke(cli, ["application", "run", "result", "download", "4711", str(tmp_path)])
292308
assert result.exit_code == 2
293309
assert "Run ID '4711' invalid" in normalize_output(result.stdout)
294310

295311

296-
def test_cli_run_result_download_uuid_not_found(runner: CliRunner, tmp_path: Path) -> None:
312+
def test_cli_run_result_download_uuid_not_found(runner: CliRunner, tmp_path: Path, record_property) -> None:
297313
"""Check run result download fails on ID not found."""
314+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
298315
result = runner.invoke(
299316
cli, ["application", "run", "result", "download", "00000000000000000000000000000000", str(tmp_path)]
300317
)
301318
assert "Run with ID '00000000000000000000000000000000' not found." in result.output.replace("\n", "")
302319
assert result.exit_code == 2
303320

304321

305-
def test_cli_run_result_delete(runner: CliRunner) -> None:
322+
def test_cli_run_result_delete(runner: CliRunner, record_property) -> None:
306323
"""Check run result delete command runs successfully."""
324+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
307325
result = runner.invoke(cli, ["application", "run", "result", "delete"])
308326
assert result.exit_code == 1
309327
assert MESSAGE_NOT_YET_IMPLEMENTED in normalize_output(result.stdout)

tests/aignostics/application/service_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ def test_application_version_valid_semver_formats(runner: CliRunner) -> None:
4141
pytest.skip(f"Application '{version_id.split(':')[0]}' not found, skipping test for this version format.")
4242

4343

44-
def test_application_version_invalid_semver_formats(runner: CliRunner) -> None:
44+
def test_application_version_invalid_semver_formats(runner: CliRunner, record_property) -> None:
4545
"""Test that invalid semver formats are rejected with ValueError."""
46+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
4647
from aignostics.application import Service as ApplicationService
4748

4849
service = ApplicationService()
@@ -72,8 +73,9 @@ def test_application_version_invalid_semver_formats(runner: CliRunner) -> None:
7273
service.application_version(version_id)
7374

7475

75-
def test_application_version_use_latest_fallback(runner: CliRunner) -> None:
76+
def test_application_version_use_latest_fallback(runner: CliRunner, record_property) -> None:
7677
"""Test that use_latest_if_no_version_given works correctly."""
78+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
7779
service = ApplicationService()
7880

7981
try:

0 commit comments

Comments
 (0)