Skip to content

Commit d3dc4a0

Browse files
chore(tests): add Platform Module Specification IDs to related tests
2 parents e683ac3 + df3028f commit d3dc4a0

File tree

4 files changed

+51
-25
lines changed

4 files changed

+51
-25
lines changed

specifications/SPEC-UTILS-SERVICE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
itemId: SPEC-UTILS-SERVICE
33
itemTitle: Utils Module Specification
44
itemType: Software Item Spec
5-
itemFulfills:
5+
itemFulfills: SPEC-APPLICATION-SERVICE, SPEC-BUCKET-SERVICE, SPEC-DATASET-SERVICE, SPEC-NOTEBOOK-SERVICE, SPEC-QUPATH-SERVICE, SPEC-SYSTEM-SERVICE
66
itemIsRelatedTo: SPEC-APPLICATION-SERVICE, SPEC-GUI-SERVICE, SPEC-BUCKET-SERVICE, SPEC-DATASET-SERVICE, SPEC-NOTEBOOK-SERVICE, SPEC-PLATFORM-SERVICE, SPEC-QUPATH-SERVICE, SPEC-SYSTEM-SERVICE, SPEC-WSI-SERVICE
77
Module: Utils
88
Layer: Infrastructure Service

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/gui_test.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525

2626

2727
@pytest.mark.sequential
28-
async def test_gui_index(user: User) -> None:
28+
async def test_gui_index(user: User, record_property) -> None:
2929
"""Test that the user sees the index page, and sees the intro."""
30+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
3031
# hello world
3132
gui_register_pages()
3233
await user.open("/")
@@ -50,9 +51,10 @@ async def test_gui_index(user: User) -> None:
5051
],
5152
)
5253
async def test_gui_home_to_application(
53-
user: User, application_id: str, application_name: str, expected_text: str, silent_logging: None
54+
user: User, application_id: str, application_name: str, expected_text: str, silent_logging: None, record_property
5455
) -> None:
5556
"""Test that the user sees the specific application page with expected content."""
57+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
5658
gui_register_pages()
5759
await user.open("/")
5860
await user.should_see(application_name, retries=100)
@@ -61,8 +63,9 @@ async def test_gui_home_to_application(
6163

6264

6365
@pytest.mark.flaky(retries=1, delay=5, only_on=[AssertionError])
64-
async def test_gui_cli_to_run_cancel(user: User, runner: CliRunner, silent_logging) -> None:
66+
async def test_gui_cli_to_run_cancel(user: User, runner: CliRunner, silent_logging: None, record_property) -> None:
6567
"""Test that the user sees the index page, and sees the intro."""
68+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
6669
with tempfile.TemporaryDirectory() as tmpdir:
6770
gui_register_pages()
6871

@@ -208,8 +211,11 @@ async def test_gui_download_dataset_via_application_to_run_cancel( # noqa: PLR0
208211

209212

210213
@pytest.mark.sequential
211-
async def test_gui_run_download(user: User, runner: CliRunner, tmp_path: Path, silent_logging: None) -> None:
214+
async def test_gui_run_download(
215+
user: User, runner: CliRunner, tmp_path: Path, silent_logging: None, record_property
216+
) -> None:
212217
"""Test that the user can download a run result via the GUI."""
218+
record_property("tested-item-id", "SPEC-APPLICATION-SERVICE")
213219
with patch(
214220
"aignostics.application._gui._page_application_run_describe.get_user_data_directory", return_value=tmp_path
215221
):

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)