Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ jobs:
pip install -e ".[dev,ui]"

- name: Run pytest
env:
# Hosted runners are slower than dev machines; relax the
# wall-clock budgets in tests/test_scenario.py and tests/test_ui.py
# by 3× for CI. Local runs keep the dossier's strict 5 s budgets.
SONOLUMEN_TIMING_BUDGET_FACTOR: "3.0"
run: pytest -v --timeout=120
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics",
]

[project.urls]
Homepage = "https://github.com/Mando-369/sonolumen"
Repository = "https://github.com/Mando-369/sonolumen"
Issues = "https://github.com/Mando-369/sonolumen/issues"
Changelog = "https://github.com/Mando-369/sonolumen/blob/main/CHANGELOG.md"
dependencies = [
"numpy>=1.26",
"scipy>=1.11",
Expand All @@ -59,6 +54,12 @@ dev = [
"pytest-timeout>=2.2",
]

[project.urls]
Homepage = "https://github.com/Mando-369/sonolumen"
Repository = "https://github.com/Mando-369/sonolumen"
Issues = "https://github.com/Mando-369/sonolumen/issues"
Changelog = "https://github.com/Mando-369/sonolumen/blob/main/CHANGELOG.md"

[tool.setuptools.packages.find]
include = ["sonolumen*"]
exclude = ["tests*", "examples*", "cavitation_research*"]
Expand Down
11 changes: 8 additions & 3 deletions tests/test_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
import ast
import dataclasses
import inspect
import os
import re
import time
from pathlib import Path

TIMING_BUDGET_FACTOR = float(os.environ.get("SONOLUMEN_TIMING_BUDGET_FACTOR", "1.0"))

import pandas as pd
import pytest

Expand Down Expand Up @@ -89,9 +92,11 @@ def test_sbsl_canonical_run_under_5s_and_in_band():
elapsed = time.time() - t0

summary = result.summary
assert elapsed < 5.0, (
f"sbsl_canonical().run() took {elapsed:.2f} s > 5 s "
f"(§12.10 #2 budget). T_peak={summary.T_peak_K:.0f} K, "
budget = 5.0 * TIMING_BUDGET_FACTOR
assert elapsed < budget, (
f"sbsl_canonical().run() took {elapsed:.2f} s > {budget:.1f} s "
f"(§12.10 #2 budget = 5 s × factor {TIMING_BUDGET_FACTOR}). "
f"T_peak={summary.T_peak_K:.0f} K, "
f"photons_4pi={summary.photons_visible_4pi:.2e}"
)
assert 30e-6 <= summary.R_max <= 50e-6, (
Expand Down
9 changes: 8 additions & 1 deletion tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@

from __future__ import annotations

import os
import time

import pytest

TIMING_BUDGET_FACTOR = float(os.environ.get("SONOLUMEN_TIMING_BUDGET_FACTOR", "1.0"))

# Skip the whole suite if Dash isn't installed (optional `[ui]` extra)
pytest.importorskip("dash")

Expand Down Expand Up @@ -112,7 +115,11 @@ def test_test_button_under_5s_all_panels_populated():
result_payload, status = run_test(payload)
elapsed = time.time() - t0
assert result_payload is not None, f"run failed: {status}"
assert elapsed < 5.0, f"run took {elapsed:.2f} s > 5 s"
budget = 5.0 * TIMING_BUDGET_FACTOR
assert elapsed < budget, (
f"run took {elapsed:.2f} s > {budget:.1f} s "
f"(§15.11 #3 budget = 5 s × factor {TIMING_BUDGET_FACTOR})"
)

# All six centre-column figure ids should be present
figs = render_figures(payload, result_payload)
Expand Down
Loading