Skip to content

Fixtures and Markers ​

TestShed registers these fixtures and markers whenever --shed is set, with no import or conftest.py needed. Markers are imported from kloudkit.testshed.docker.decorators when you apply them.

Containers ​

FixtureScopeReturns
shedfunctionThe shared container, or a dedicated one when the test has markers.
shed_deferredfunctionshed_deferred(envs=…, volumes=…, **kwargs): starts a container when called.
shed_attachfunctionshed_attach(name_or_id): wraps a running container you manage.
shed_defaultsessionThe shared container shed returns without markers.
shed_factoryfunctionStarts a shed container with the defaults merged in; behind shed.
docker_sidecarfunctiondocker_sidecar(image, **kwargs): starts a container from any image.
docker_module_sidecarmoduleSame as docker_sidecar, removed after the module.
docker_session_sidecarsessionSame as docker_sidecar, removed after the session.
playwright_browsersessionA Playwright Browser connected to Chromium in a container.

Settings and Paths ​

FixtureScopeReturns
shed_container_defaultssession{}; override it to set defaults for every shed container.
shed_tagsessionThe image used, as image:tag or image@sha256:….
shed_statesessionThe session's resolved settings: image, tag, network, labels and paths.
test_rootsessionThe tests directory, as an absolute path (--shed-tests-dir).
project_rootsessionThe source directory, as an absolute path (--shed-src-dir).
downloaderfunctiondownloader(url, output): downloads into tmp_path, returns the Path.

downloader also takes method, allow_redirects, raise_for_status and request_options (passed to requests).

Container Arguments ​

docker_sidecar, shed_deferred and @shed_config take any argument of python-on-whales' docker.run, plus:

ArgumentDescription
probeA readiness probe to wait for; None for none.
timeoutSeconds to wait for the probe, keeping its other fields (not on sidecars).
container_classThe Container subclass to wrap the container in.
volumes(source, dest) tuples or volume objects, mounted read-only.
networksNetworks to join instead of the session's network.
detachFalse runs the container to completion and returns its output (sidecars only).

Markers ​

MarkerEffect
@shed_env(**envs)Set environment variables.
@shed_volumes(*mounts)Mount (source, dest) tuples or volume objects, read-only.
@shed_config(**kwargs)Pass container arguments (see above).
@shed_mutable()Give the test its own container, without other settings.

Released under the MIT License