Refactor: Oddělení business logiky + inline editor
Some checks failed
Build & Push Docker / build (push) Has been cancelled

- Nový modul scenar/core.py (491 řádků čisté logiky)
- Refactored cgi-bin/scenar.py (450 řádků CGI wrapper)
- Inline editor s JavaScript row managementem
- Custom exceptions (ScenarsError, ValidationError, TemplateError)
- Kompletní test coverage (10 testů, všechny )
- Fixed Dockerfile (COPY scenar/, requirements.txt)
- Fixed requirements.txt (openpyxl==3.1.5)
- Fixed pytest.ini (pythonpath = .)
- Nové testy: test_http_inline.py, test_inline_builder.py
- HTTP testy označeny jako @pytest.mark.integration
- Build script: scripts/build_image.sh
- Dokumentace: COMPLETION.md
This commit is contained in:
Martin Sukany
2025-11-13 16:06:32 +01:00
parent 9a7ffdeb2c
commit b7b56fe15f
16 changed files with 2674 additions and 541 deletions

View File

@@ -2,14 +2,13 @@ import os
import shutil
import subprocess
import time
import socket
import urllib.request
import pytest
def docker_available():
return shutil.which("docker") is not None
def podman_available():
return shutil.which("podman") is not None
def wait_for_http(url, timeout=30):
@@ -26,23 +25,29 @@ def wait_for_http(url, timeout=30):
raise RuntimeError(f"HTTP check failed after {timeout}s: {last_exc}")
@pytest.mark.skipif(not docker_available(), reason="Docker is not available on this runner")
@pytest.mark.skipif(not podman_available(), reason="Podman is not available on this runner")
@pytest.mark.integration
def test_build_run_and_cleanup_docker():
def test_build_run_and_cleanup_podman():
image_tag = "scenar-creator:latest"
container_name = "scenar-creator-test"
port = int(os.environ.get('SCENAR_TEST_PORT', '8080'))
# Ensure podman machine is running (macOS/Windows)
if not subprocess.run(["podman", "machine", "info"], capture_output=True).returncode == 0:
print("Starting podman machine...")
subprocess.run(["podman", "machine", "start"], check=True)
time.sleep(2)
# Build image
subprocess.run(["docker", "build", "-t", image_tag, "."], check=True)
subprocess.run(["podman", "build", "-t", image_tag, "."], check=True)
# Ensure no leftover container
subprocess.run(["docker", "rm", "-f", container_name], check=False)
subprocess.run(["podman", "rm", "-f", container_name], check=False)
try:
# Run container
subprocess.run([
"docker", "run", "-d", "--name", container_name, "-p", f"{port}:8080", image_tag
"podman", "run", "-d", "--name", container_name, "-p", f"{port}:8080", image_tag
], check=True)
# Wait for HTTP and verify content
@@ -52,5 +57,5 @@ def test_build_run_and_cleanup_docker():
finally:
# Cleanup container and image
subprocess.run(["docker", "rm", "-f", container_name], check=False)
subprocess.run(["docker", "rmi", image_tag], check=False)
subprocess.run(["podman", "rm", "-f", container_name], check=False)
subprocess.run(["podman", "rmi", image_tag], check=False)