Some checks failed
CI / skinny-install (aco) (push) Successful in 1m8s
CI / skinny-install (api) (push) Successful in 31s
CI / skinny-install (bcda) (push) Successful in 50s
CI / skinny-install (bib) (push) Successful in 30s
CI / skinny-install (bls) (push) Successful in 27s
CI / skinny-install (ccw) (push) Successful in 30s
CI / skinny-install (cli) (push) Successful in 38s
CI / skinny-install (cms) (push) Successful in 36s
CI / skinny-install (conf) (push) Failing after 1s
CI / skinny-install (opps) (push) Successful in 37s
CI / skinny-install (perf) (push) Successful in 37s
CI / skinny-install (pfs) (push) Successful in 41s
CI / skinny-install (rex) (push) Successful in 39s
CI / lint-test (push) Failing after 10m54s
Deploy / build-scan-report (push) Successful in 5m45s
- tests/bib/test_sync.py: add fields/itemTypes/creatorTypes tables + seed data so Db.__init__ _verify_schema_parity passes. - compose.yml: git service gets security_opt no-new-privileges; marimo.toml mount gets :ro. - .state/.gitkeep: ensures bind mount source exists in CI checkout. - tests/test_notebook_layout.py: flip home-page-patched.js assertion (file was replaced by theme overlay build). - tests/zot/test_extract.py: provenance count 3→4 (extra item type from Zotero 7 schema).
128 lines
4.3 KiB
Python
128 lines
4.3 KiB
Python
"""Tests for notebook separation of concerns — config in infra/, content in notebooks/."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import tomllib
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
NOTEBOOKS = ROOT / "notebooks"
|
|
INFRA_MARIMO = ROOT / "infra" / "marimo"
|
|
|
|
|
|
class TestNotebooksClean:
|
|
"""notebooks/ should contain only .py notebook files."""
|
|
|
|
def test_no_config_files(self):
|
|
"""No TOML, CSS, JS, or hidden config dirs in notebooks/."""
|
|
bad = []
|
|
for p in NOTEBOOKS.iterdir():
|
|
if p.name.startswith("__"):
|
|
continue # __marimo__, __pycache__ are fine
|
|
if p.name == "aco.duckdb":
|
|
continue # symlink, gitignored
|
|
if p.suffix not in (".py",):
|
|
bad.append(p.name)
|
|
if p.name.startswith("."):
|
|
bad.append(p.name)
|
|
assert bad == [], f"Non-notebook files found: {bad}"
|
|
|
|
def test_only_py_files(self):
|
|
"""All visible files are .py notebooks."""
|
|
py_files = [
|
|
p
|
|
for p in NOTEBOOKS.iterdir()
|
|
if p.is_file() and not p.name.startswith("__") and p.name != "aco.duckdb"
|
|
]
|
|
assert all(p.suffix == ".py" for p in py_files)
|
|
assert len(py_files) >= 12
|
|
|
|
def test_no_marimo_config_dir(self):
|
|
assert not (NOTEBOOKS / ".marimo-config").exists()
|
|
|
|
def test_no_marimo_toml(self):
|
|
assert not (NOTEBOOKS / ".marimo.toml").exists()
|
|
|
|
def test_no_snippets_dir(self):
|
|
assert not (NOTEBOOKS / "snippets").exists()
|
|
|
|
def test_no_home_page_js(self):
|
|
assert not (NOTEBOOKS / "home-page-patched.js").exists()
|
|
|
|
|
|
class TestInfraMarimo:
|
|
"""infra/marimo/ should contain server config, snippets, and assets."""
|
|
|
|
def test_directory_exists(self):
|
|
assert INFRA_MARIMO.is_dir()
|
|
|
|
def test_marimo_toml_exists(self):
|
|
assert (INFRA_MARIMO / "marimo.toml").is_file()
|
|
|
|
def test_marimo_toml_valid(self):
|
|
text = (INFRA_MARIMO / "marimo.toml").read_text()
|
|
data = tomllib.loads(text)
|
|
assert "display" in data
|
|
assert "snippets" in data
|
|
assert "runtime" in data
|
|
|
|
def test_snippet_path_updated(self):
|
|
text = (INFRA_MARIMO / "marimo.toml").read_text()
|
|
data = tomllib.loads(text)
|
|
paths = data["snippets"]["custom_paths"]
|
|
assert any(".config/marimo/snippets" in p for p in paths)
|
|
assert not any("notebooks/snippets" in p for p in paths)
|
|
|
|
def test_snippets_directory(self):
|
|
snippets_dir = INFRA_MARIMO / "snippets"
|
|
assert snippets_dir.is_dir()
|
|
snippet_files = list(snippets_dir.glob("*.py"))
|
|
assert len(snippet_files) == 11
|
|
|
|
def test_all_snippets_present(self):
|
|
expected = {
|
|
"bib-connect.py",
|
|
"chart-bar.py",
|
|
"chart-line.py",
|
|
"duckdb-connect.py",
|
|
"nessie-connect.py",
|
|
"query-demographics.py",
|
|
"query-pmpm.py",
|
|
"query-schema.py",
|
|
"s3-obstore.py",
|
|
"skin-subs-connect.py",
|
|
"trino-connect.py",
|
|
}
|
|
actual = {p.name for p in (INFRA_MARIMO / "snippets").iterdir()}
|
|
assert actual == expected
|
|
|
|
def test_home_page_js_removed(self):
|
|
"""home-page-patched.js was replaced by the theme overlay build."""
|
|
assert not (INFRA_MARIMO / "home-page-patched.js").exists()
|
|
|
|
def test_no_fhirworx_css_duplicate(self):
|
|
"""fhirworx.css should NOT be in infra/marimo/ — served from assets/css/."""
|
|
assert not (INFRA_MARIMO / "fhirworx.css").exists()
|
|
|
|
|
|
class TestNoStaleReferences:
|
|
"""No stale paths to old locations in config files."""
|
|
|
|
def test_compose_no_old_config_mount(self):
|
|
text = (ROOT / "compose.yml").read_text()
|
|
assert ".marimo-config" not in text
|
|
|
|
def test_compose_no_old_homepage_mount(self):
|
|
text = (ROOT / "compose.yml").read_text()
|
|
assert "notebooks/home-page" not in text
|
|
|
|
def test_compose_uses_infra_marimo(self):
|
|
text = (ROOT / "compose.yml").read_text()
|
|
assert "infra/marimo" in text
|
|
|
|
def test_stack_toml_path_filter(self):
|
|
text = (ROOT / "stack.toml").read_text()
|
|
data = tomllib.loads(text)
|
|
filters = data["images"]["notebooks"]["path_filter"]
|
|
assert "infra/marimo/**" in filters
|