Loading tests/environment.py +11 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ from __future__ import annotations import sys from contextlib import contextmanager from os import environ from pathlib import Path from typing import TYPE_CHECKING from typing import Any Loading Loading @@ -140,7 +141,11 @@ def test_cluster(site_url: str) -> Iterator[Site]: ), ) frontend = Container( Image.build(BUILD_CONTEXT, target='nginx'), Image.build( BUILD_CONTEXT, target='nginx', nginx_version=environ.get("NGINX_VERSION"), ), network=network, volumes=[ ("static", Path("/app/static")), Loading @@ -148,7 +153,11 @@ def test_cluster(site_url: str) -> Iterator[Site]: ], ) backend = Wordpress( Image.build(BUILD_CONTEXT), Image.build( BUILD_CONTEXT, php_version=environ.get("PHP_VERSION"), wp_version=environ.get("WP_VERSION"), ), network=network, volumes=frontend.volumes, env=dict( Loading @@ -173,7 +182,6 @@ def test_cluster(site_url: str) -> Iterator[Site]: if __name__ == "__main__": from os import environ from subprocess import run with test_cluster(SITE_URL) as site: Loading tests/wp/docker.py +5 −2 Original line number Diff line number Diff line Loading @@ -155,13 +155,16 @@ class Image(Item): self.iid = iid @classmethod def build(cls: type[T], context: Path, target: str = "", **build_args: str) -> T: def build(cls: type[T], context: Path, target: str = "", **build_args: str|None) -> T: """ Build an image from the given context Build arguments are ignored if they are None to make it easier to supply (or not) arguments from external lookups without complex argument composing. """ cmd: Arguments = [ 'build', context, f"--target={target}", *(f"--build-arg={arg}={val}" for arg, val in build_args.items()), *(f"--build-arg={arg}={val}" for arg, val in build_args.items() if val is not None), ] docker(*cmd, DOCKER_BUILDKIT='1') iid = docker_output(*cmd, '-q', DOCKER_BUILDKIT='1') Loading Loading
tests/environment.py +11 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ from __future__ import annotations import sys from contextlib import contextmanager from os import environ from pathlib import Path from typing import TYPE_CHECKING from typing import Any Loading Loading @@ -140,7 +141,11 @@ def test_cluster(site_url: str) -> Iterator[Site]: ), ) frontend = Container( Image.build(BUILD_CONTEXT, target='nginx'), Image.build( BUILD_CONTEXT, target='nginx', nginx_version=environ.get("NGINX_VERSION"), ), network=network, volumes=[ ("static", Path("/app/static")), Loading @@ -148,7 +153,11 @@ def test_cluster(site_url: str) -> Iterator[Site]: ], ) backend = Wordpress( Image.build(BUILD_CONTEXT), Image.build( BUILD_CONTEXT, php_version=environ.get("PHP_VERSION"), wp_version=environ.get("WP_VERSION"), ), network=network, volumes=frontend.volumes, env=dict( Loading @@ -173,7 +182,6 @@ def test_cluster(site_url: str) -> Iterator[Site]: if __name__ == "__main__": from os import environ from subprocess import run with test_cluster(SITE_URL) as site: Loading
tests/wp/docker.py +5 −2 Original line number Diff line number Diff line Loading @@ -155,13 +155,16 @@ class Image(Item): self.iid = iid @classmethod def build(cls: type[T], context: Path, target: str = "", **build_args: str) -> T: def build(cls: type[T], context: Path, target: str = "", **build_args: str|None) -> T: """ Build an image from the given context Build arguments are ignored if they are None to make it easier to supply (or not) arguments from external lookups without complex argument composing. """ cmd: Arguments = [ 'build', context, f"--target={target}", *(f"--build-arg={arg}={val}" for arg, val in build_args.items()), *(f"--build-arg={arg}={val}" for arg, val in build_args.items() if val is not None), ] docker(*cmd, DOCKER_BUILDKIT='1') iid = docker_output(*cmd, '-q', DOCKER_BUILDKIT='1') Loading