src layout: move core code into src/tinyweb/ package
- Moved app.py, db.py, gateway.py, templates.py, embeddings.py, rns_client.py, and handlers/ into src/tinyweb/ - Created root app.py shim (adds src/ to sys.path, imports main) - Created pyproject.toml with setuptools config (where = ["src"]) - Added src/tinyweb/__init__.py - Updated all internal imports to use tinyweb. prefix (73 occurrences) - Removed sys.path.insert hack from conftest.py - Updated Dockerfile: pip install -e /app before running - Updated gateway.py usage message: python -m tinyweb.gateway - Updated README.md gateway usage instructions
This commit is contained in:
parent
60aa4b274a
commit
3e30678e21
35 changed files with 400 additions and 384 deletions
|
|
@ -14,12 +14,12 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
import app as app_module
|
||||
import db as db_module
|
||||
import handlers as handlers_module
|
||||
from tinyweb import app as app_module
|
||||
import tinyweb.db as db_module
|
||||
import tinyweb.handlers as handlers_module
|
||||
from conftest import patch_dns_fail, patch_dns_ok
|
||||
from db import clean_url
|
||||
from handlers import _sanitize_fts_query, handle_bulk_action
|
||||
from tinyweb.db import clean_url
|
||||
from tinyweb.handlers import _sanitize_fts_query, handle_bulk_action
|
||||
|
||||
|
||||
def test_6ffd38d_clean_url_preserves_www_when_bare_domain_fails(monkeypatch):
|
||||
|
|
@ -47,7 +47,7 @@ def test_1bc695f_fts_sanitizer_drops_operator_words(op):
|
|||
def test_1bc695f_gateway_rejects_oversize_body():
|
||||
"""1bc695f: 16 MiB body-size cap prevents memory-exhaustion DoS."""
|
||||
from tests.test_gateway_limits import FakeGatewayHandler
|
||||
from gateway import MAX_BODY_SIZE
|
||||
from tinyweb.gateway import MAX_BODY_SIZE
|
||||
h = FakeGatewayHandler(
|
||||
path="/add", method="POST",
|
||||
headers={"Content-Length": str(MAX_BODY_SIZE + 1)},
|
||||
|
|
@ -70,7 +70,7 @@ def test_1bc695f_mesh_rejects_non_whitelisted_paths():
|
|||
def test_1bc695f_pool_returns_clean_connection(temp_db, monkeypatch):
|
||||
"""1bc695f: uncommitted transactions on a pooled connection used to leak
|
||||
into the next consumer."""
|
||||
from db import get_db, return_db
|
||||
from tinyweb.db import get_db, return_db
|
||||
db = get_db()
|
||||
db.execute(
|
||||
"INSERT INTO pages (url, title, body) VALUES (?, ?, ?)",
|
||||
|
|
@ -88,7 +88,7 @@ def test_1bc695f_pool_returns_clean_connection(temp_db, monkeypatch):
|
|||
def test_8dffd8c_bulk_delete_requires_confirmation(seeded_db, csrf_session):
|
||||
"""8dffd8c: bulk delete without confirmed=1 must render a confirm page
|
||||
instead of deleting — the JS confirm on /pages is a first-line filter only."""
|
||||
from db import get_db, return_db
|
||||
from tinyweb.db import get_db, return_db
|
||||
db = get_db()
|
||||
try:
|
||||
pid = db.execute("SELECT id FROM pages LIMIT 1").fetchone()["id"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue