From e6215f84bf2cab0bbd8bb0a42ddae0ee6de3cfd6 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Wed, 11 Nov 2026 19:57:38 +0100 Subject: Vendor responsive image plugin locally This adds the responsive-image plugin directly to the project, including its source code, documentation, and tests, allowing it to be maintained locally. It also configures responsive image sizes, updates gallery images to use srcset, and preserves original image URLs for full-resolution viewing. Markdown images gain lazy loading while retaining compatibility with the existing image viewer. --- packages/responsive-image/tests/conftest.py | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 packages/responsive-image/tests/conftest.py (limited to 'packages/responsive-image/tests/conftest.py') diff --git a/packages/responsive-image/tests/conftest.py b/packages/responsive-image/tests/conftest.py new file mode 100644 index 0000000..f7a81df --- /dev/null +++ b/packages/responsive-image/tests/conftest.py @@ -0,0 +1,48 @@ +import os +from contextlib import ExitStack + +import pytest +from lektor.builder import Builder +from lektor.context import Context +from lektor.project import Project + + +@pytest.fixture +def lektor_env(): + site_path = os.path.join(os.path.dirname(__file__), "test-site") + return Project.from_path(site_path).make_env(load_plugins=False) + + +@pytest.fixture +def lektor_pad(lektor_env): + return lektor_env.new_pad() + + +@pytest.fixture +def lektor_builder(lektor_pad, tmp_path): + return Builder(lektor_pad, str(tmp_path)) + + +@pytest.fixture +def lektor_build_state(lektor_builder): + build_state = lektor_builder.new_build_state() + with ExitStack() as stack: + if hasattr(build_state, "__enter__"): + build_state = stack.enter_context(build_state) # lektor < 3.4 + yield build_state + + +@pytest.fixture +def lektor_source(lektor_pad): + return lektor_pad.root + + +@pytest.fixture +def lektor_artifact(lektor_build_state, lektor_source): + return lektor_build_state.new_artifact("test.html", source_obj=lektor_source) + + +@pytest.fixture +def lektor_context(lektor_artifact): + with Context(lektor_artifact) as ctx: + yield ctx -- cgit v1.3.1