Skip to content

Commit 109ebff

Browse files
committed
ci: Remove the sonar cloud duplication issue
1 parent 44982f2 commit 109ebff

1 file changed

Lines changed: 45 additions & 66 deletions

File tree

tests/constants_test.py

Lines changed: 45 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,47 @@
6262
SPOT_4_WIDTH = 3728
6363
SPOT_4_HEIGHT = 3640
6464

65+
# To update file sizes: the tests print every file's actual size before asserting. Run with
66+
# -s to see them, then paste the printed byte values as the second element of each tuple.
67+
# SPOT_0: uv run pytest tests/aignostics/application/gui_test.py::test_gui_run_download -s --no-cov
68+
# SPOT_1: uv run pytest tests/aignostics/application/cli_test.py::test_cli_run_execute -s --no-cov
69+
#
70+
# These defaults reflect the production he-tme run. If staging produces different output (e.g.
71+
# after deploying a new application version to staging before production), add an override inside
72+
# the "staging" case below — only the constants that actually differ need to be reassigned.
73+
# Note: defined here rather than inside each match arm to avoid SonarCloud flagging the
74+
# nearly-identical blocks as duplicated code (the 3% duplication threshold).
75+
SPOT_0_EXPECTED_RESULT_FILES = [
76+
("tissue_qc_segmentation_map_image.tiff", 1645652, 10),
77+
("tissue_qc_geojson_polygons.json", 101150, 10),
78+
("tissue_segmentation_geojson_polygons.json", 327625, 10),
79+
("readout_generation_slide_readouts.csv", 303585, 10),
80+
("readout_generation_cell_readouts.csv", 1660865, 10),
81+
("cell_classification_geojson_polygons.json", 6117357, 10),
82+
("tissue_segmentation_segmentation_map_image.tiff", 2858496, 10),
83+
("tissue_segmentation_csv_class_information.csv", 452, 10),
84+
("tissue_qc_csv_class_information.csv", 285, 10),
85+
("tissue_qc_parquet_polygons.parquet", 39435, 10),
86+
("tissue_segmentation_parquet_polygons.parquet", 117509, 10),
87+
("cell_classification_parquet_polygons.parquet", 1985592, 10),
88+
]
89+
SPOT_0_EXPECTED_CELLS_CLASSIFIED = (39798, 10)
90+
91+
SPOT_1_EXPECTED_RESULT_FILES = [
92+
("tissue_qc_segmentation_map_image.tiff", 1288632, 10),
93+
("tissue_qc_geojson_polygons.json", 75281, 10),
94+
("tissue_segmentation_geojson_polygons.json", 152301, 10),
95+
("readout_generation_slide_readouts.csv", 299361, 10),
96+
("readout_generation_cell_readouts.csv", 464838, 10),
97+
("cell_classification_geojson_polygons.json", 1726813, 10),
98+
("tissue_segmentation_segmentation_map_image.tiff", 1783376, 10),
99+
("tissue_segmentation_csv_class_information.csv", 446, 10),
100+
("tissue_qc_csv_class_information.csv", 290, 10),
101+
("tissue_qc_parquet_polygons.parquet", 29087, 10),
102+
("tissue_segmentation_parquet_polygons.parquet", 56563, 10),
103+
("cell_classification_parquet_polygons.parquet", 562536, 10),
104+
]
105+
65106
match os.getenv("AIGNOSTICS_PLATFORM_ENVIRONMENT", "production"):
66107
case "production":
67108
TEST_APPLICATION_ID = "test-app"
@@ -78,41 +119,6 @@
78119
PIPELINE_CPU_PROVISIONING_MODE = "SPOT"
79120
PIPELINE_NODE_ACQUISITION_TIMEOUT_MINUTES = 25
80121

81-
# To update file sizes: the tests print every file's actual size before asserting. Run with
82-
# -s to see them, then paste the printed byte values as the second element of each tuple.
83-
# SPOT_0: uv run pytest tests/aignostics/application/gui_test.py::test_gui_run_download -s --no-cov
84-
# SPOT_1: uv run pytest tests/aignostics/application/cli_test.py::test_cli_run_execute -s --no-cov
85-
SPOT_0_EXPECTED_RESULT_FILES = [
86-
("tissue_qc_segmentation_map_image.tiff", 1645652, 10),
87-
("tissue_qc_geojson_polygons.json", 101150, 10),
88-
("tissue_segmentation_geojson_polygons.json", 327625, 10),
89-
("readout_generation_slide_readouts.csv", 303585, 10),
90-
("readout_generation_cell_readouts.csv", 1660865, 10),
91-
("cell_classification_geojson_polygons.json", 6117357, 10),
92-
("tissue_segmentation_segmentation_map_image.tiff", 2858496, 10),
93-
("tissue_segmentation_csv_class_information.csv", 452, 10),
94-
("tissue_qc_csv_class_information.csv", 285, 10),
95-
("tissue_qc_parquet_polygons.parquet", 39435, 10),
96-
("tissue_segmentation_parquet_polygons.parquet", 117509, 10),
97-
("cell_classification_parquet_polygons.parquet", 1985592, 10),
98-
]
99-
SPOT_0_EXPECTED_CELLS_CLASSIFIED = (39798, 10)
100-
101-
SPOT_1_EXPECTED_RESULT_FILES = [
102-
("tissue_qc_segmentation_map_image.tiff", 1288632, 10),
103-
("tissue_qc_geojson_polygons.json", 75281, 10),
104-
("tissue_segmentation_geojson_polygons.json", 152301, 10),
105-
("readout_generation_slide_readouts.csv", 299361, 10),
106-
("readout_generation_cell_readouts.csv", 464838, 10),
107-
("cell_classification_geojson_polygons.json", 1726813, 10),
108-
("tissue_segmentation_segmentation_map_image.tiff", 1783376, 10),
109-
("tissue_segmentation_csv_class_information.csv", 446, 10),
110-
("tissue_qc_csv_class_information.csv", 290, 10),
111-
("tissue_qc_parquet_polygons.parquet", 29087, 10),
112-
("tissue_segmentation_parquet_polygons.parquet", 56563, 10),
113-
("cell_classification_parquet_polygons.parquet", 562536, 10),
114-
]
115-
116122
case "staging":
117123
TEST_APPLICATION_ID = "test-app"
118124
TEST_APPLICATION_VERSION = "1.0.0"
@@ -128,37 +134,10 @@
128134
PIPELINE_CPU_PROVISIONING_MODE = "SPOT"
129135
PIPELINE_NODE_ACQUISITION_TIMEOUT_MINUTES = 25
130136

131-
# See production block above for instructions on how to update these sizes.
132-
SPOT_0_EXPECTED_RESULT_FILES = [
133-
("tissue_qc_segmentation_map_image.tiff", 1645652, 10),
134-
("tissue_qc_geojson_polygons.json", 101150, 10),
135-
("tissue_segmentation_geojson_polygons.json", 327625, 10),
136-
("readout_generation_slide_readouts.csv", 303585, 10),
137-
("readout_generation_cell_readouts.csv", 1660865, 10),
138-
("cell_classification_geojson_polygons.json", 6117357, 10),
139-
("tissue_segmentation_segmentation_map_image.tiff", 2858496, 10),
140-
("tissue_segmentation_csv_class_information.csv", 452, 10),
141-
("tissue_qc_csv_class_information.csv", 285, 10),
142-
("tissue_qc_parquet_polygons.parquet", 39435, 10),
143-
("tissue_segmentation_parquet_polygons.parquet", 117509, 10),
144-
("cell_classification_parquet_polygons.parquet", 1985592, 10),
145-
]
146-
SPOT_0_EXPECTED_CELLS_CLASSIFIED = (39798, 10)
147-
148-
SPOT_1_EXPECTED_RESULT_FILES = [
149-
("tissue_qc_segmentation_map_image.tiff", 1288632, 10),
150-
("tissue_qc_geojson_polygons.json", 75281, 10),
151-
("tissue_segmentation_geojson_polygons.json", 152301, 10),
152-
("readout_generation_slide_readouts.csv", 299361, 10),
153-
("readout_generation_cell_readouts.csv", 464838, 10),
154-
("cell_classification_geojson_polygons.json", 1726813, 10),
155-
("tissue_segmentation_segmentation_map_image.tiff", 1783376, 10),
156-
("tissue_segmentation_csv_class_information.csv", 446, 10),
157-
("tissue_qc_csv_class_information.csv", 290, 10),
158-
("tissue_qc_parquet_polygons.parquet", 29087, 10),
159-
("tissue_segmentation_parquet_polygons.parquet", 56563, 10),
160-
("cell_classification_parquet_polygons.parquet", 562536, 10),
161-
]
137+
# If staging outputs differ from the defaults above, override them here, e.g.:
138+
# SPOT_0_EXPECTED_RESULT_FILES = [("tissue_qc_segmentation_map_image.tiff", <bytes>, 10), ...]
139+
# SPOT_0_EXPECTED_CELLS_CLASSIFIED = (<count>, 10)
140+
# SPOT_1_EXPECTED_RESULT_FILES = [("tissue_qc_segmentation_map_image.tiff", <bytes>, 10), ...]
162141

163142
case _:
164143
message = f"Unsupported AIGNOSTICS_PLATFORM_ENVIRONMENT value: {os.getenv('AIGNOSTICS_PLATFORM_ENVIRONMENT')}"

0 commit comments

Comments
 (0)