Skip to content

Commit 658dcdb

Browse files
authored
Merge pull request #202 from MBARIMike/main
Don't remove previous deployments from the quick_look_plots.html file.
2 parents 594d583 + 661d215 commit 658dcdb

2 files changed

Lines changed: 42 additions & 4 deletions

File tree

‎src/data/lrauv_deployment_plots.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,6 @@ def _update_index_html(
528528
content = index_path.read_text()
529529
all_hrefs = set(re.findall(r'href="([^"#][^"]*\.html)"', content))
530530
group_names = dict(re.findall(r'<h2 id="([^"]+)">([^<]+)</h2>', content))
531-
# Drop hrefs whose filename has a prefix before the group name (old auv_name_ style).
532-
all_hrefs = {
533-
h for h in all_hrefs if "/" not in h or Path(h).name.startswith(h.split("/")[0])
534-
}
535531
# clobber=True drops only this deployment's existing entries so they are rebuilt;
536532
# other deployments' entries are always preserved.
537533
known_hrefs = (

‎src/data/test_lrauv_deployment_plots.py‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,48 @@ def test_missing_png_produces_no_html(self, dp, tmp_path):
415415
assert not (tmp_path / "ghost.html").exists() # noqa: S101
416416

417417

418+
class TestUpdateIndexHtml:
419+
"""Regression tests for quick_look_plots.html accumulating multiple deployments.
420+
421+
a3f4b45 ("Drop <auv_name> suffix from all the file names.") added a filter
422+
intended to purge leftover old auv_name-prefixed hrefs when re-reading an
423+
existing index, but it compared the href's filename against the date-range
424+
dlist_dir instead of the old auv_name prefix. Since filenames are built from
425+
the deployment name (not the dlist_dir), the filter matched nothing on
426+
re-read and silently dropped every previously recorded deployment's entries.
427+
"""
428+
429+
def test_preserves_prior_deployments_across_calls(self, dp, tmp_path):
430+
"""A second deployment's _update_index_html() call must not erase the
431+
first deployment's entries."""
432+
year_dir = tmp_path / "2025"
433+
depl_dir_1 = year_dir / "20250414_20250418"
434+
depl_dir_2 = year_dir / "20250501_20250505"
435+
depl_dir_1.mkdir(parents=True)
436+
depl_dir_2.mkdir(parents=True)
437+
438+
dp._update_index_html(
439+
depl_dir_1,
440+
[depl_dir_1 / "CANON_April_2025_2column_cmocean.html"],
441+
deployment_name="CANON April 2025",
442+
)
443+
dp._update_index_html(
444+
depl_dir_2,
445+
[depl_dir_2 / "CANON_May_2025_2column_cmocean.html"],
446+
deployment_name="CANON May 2025",
447+
)
448+
449+
content = (year_dir / "quick_look_plots.html").read_text()
450+
assert ( # noqa: S101
451+
'href="20250414_20250418/CANON_April_2025_2column_cmocean.html"' in content
452+
)
453+
assert ( # noqa: S101
454+
'href="20250501_20250505/CANON_May_2025_2column_cmocean.html"' in content
455+
)
456+
assert "CANON April 2025" in content # noqa: S101
457+
assert "CANON May 2025" in content # noqa: S101
458+
459+
418460
# ---------------------------------------------------------------------------
419461
# Tests for plot_deployment() — exercises the stoqs_url_from_ds call path
420462
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)