25b0741003
Refs #119 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
36 lines
1020 B
Python
36 lines
1020 B
Python
"""Runs the plain-node save-image helper test (tests/js/test_save_image.js).
|
|
|
|
Same thin pytest wrapper pattern as test_vision_overlay_js.py: shells out to
|
|
``node`` and asserts the script's own exit code. Skips (does not fail) when
|
|
node is not installed.
|
|
|
|
Covers gitea:Adriano/TieMeasureFlow#119.
|
|
"""
|
|
import shutil
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
FLASK_APP_DIR = Path(__file__).resolve().parent.parent
|
|
JS_TEST = Path(__file__).resolve().parent / "js" / "test_save_image.js"
|
|
|
|
|
|
def test_save_image_js_behaviour():
|
|
node = shutil.which("node")
|
|
if not node:
|
|
pytest.skip("node non installato: test JS del salvataggio immagine saltato")
|
|
|
|
result = subprocess.run(
|
|
[node, str(JS_TEST)],
|
|
cwd=str(FLASK_APP_DIR),
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=30,
|
|
)
|
|
|
|
assert result.returncode == 0, (
|
|
f"tests/js/test_save_image.js fallito (exit {result.returncode})\n"
|
|
f"stdout:\n{result.stdout}\nstderr:\n{result.stderr}"
|
|
)
|