Add mockapi source files and tests
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-03-22 21:59:17 +00:00
parent 0b8485a286
commit 0a28cc443a

View File

@@ -6,7 +6,7 @@ import sys
import threading
import time
from pathlib import Path
from typing import Optional
from typing import Optional, Callable
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
@@ -16,17 +16,12 @@ class HotReloadHandler(FileSystemEventHandler):
"""Handler for file system events."""
def __init__(self, spec_file: str, debounce_ms: int = 500):
"""Initialize the handler.
Args:
spec_file: Path to the spec file to watch
debounce_ms: Debounce delay in milliseconds
"""
"""Initialize the handler."""
super().__init__()
self.spec_file = Path(spec_file).resolve()
self.debounce_ms = debounce_ms
self.last_reload_time = 0
self.reload_callback: Optional[callable] = None
self.reload_callback: Optional[Callable] = None
def on_modified(self, event):
"""Handle file modification events."""
@@ -57,14 +52,7 @@ class HotReloader:
host: str = "0.0.0.0",
debounce_ms: int = 500,
):
"""Initialize the hot reloader.
Args:
spec_file: Path to the OpenAPI spec file
port: Server port
host: Server host
debounce_ms: Debounce delay for rapid changes
"""
"""Initialize the hot reloader."""
self.spec_file = Path(spec_file).resolve()
self.port = port
self.host = host
@@ -134,4 +122,4 @@ class HotReloader:
self.server_process.terminate()
self.server_process.wait()
self._start_server()
self._start_server()