diff options
| author | Dennis Fink | 2026-11-11 19:57:38 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-11 19:57:38 +0100 |
| commit | e6215f84bf2cab0bbd8bb0a42ddae0ee6de3cfd6 (patch) | |
| tree | 83910d7fee66d210464318bc7ad568c713e25e2d /packages/responsive-image/tests/conftest.py | |
| parent | 8963ed31ce537a736ddba99baf68b31858b319b8 (diff) | |
| download | dennisfink.me-main.tar.gz dennisfink.me-main.zip | |
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.
Diffstat (limited to 'packages/responsive-image/tests/conftest.py')
| -rw-r--r-- | packages/responsive-image/tests/conftest.py | 48 |
1 files changed, 48 insertions, 0 deletions
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 |
