[WIP] add: container test plugin for pytest#17372
Draft
realsdx wants to merge 2 commits into
Draft
Conversation
realsdx
commented
May 20, 2026
| images with a given capability. | ||
| - **Image-specific:** add `cases/<image-family>/test_<topic>.py`. Tests | ||
| in such subdirectories are **automatically** restricted to that | ||
| - **Image-specific static:** add `cases/static/<image-family>/test_<topic>.py`. |
Contributor
Author
There was a problem hiding this comment.
I have odd feeling about these directory-based tests discovery, markers might be more useful. As you add more and more tests, directories and subdirectories just for categorization might become too complex.
12 tasks
reubeno
reviewed
May 22, 2026
| @pytest.mark.dockerfile() | ||
| def test_nginx_config_valid(container_exec) -> None: | ||
| """nginx configuration must pass validation.""" | ||
| result = container_exec("nginx -t 2>&1") |
| - **`uv`** — Python project/package manager | ||
|
|
||
| For runtime tests, the **podman socket** must be active: | ||
| (ASK: Do we need this? podman-py is quite basic, maybe it's better without REST API and directly invoking podman CLI? The socket requirement is a bit of a pain, especially for WSL users. Then would need to have our own wrapper around podman CLI to handle the container orchestration logic currently in `container_runtime.py`. Or even docker SDK with moby might be more stable than podman-py?) |
Member
There was a problem hiding this comment.
Definitely open to other options here -- but we should leverage existing OSS if we can.
What about https://github.com/gabrieldemarmiesse/python-on-whales ? That seems to work with podman in rootless, daemonless mode too.
| COPY nginx.conf /etc/nginx/nginx.conf | ||
| ``` | ||
|
|
||
| Mark tests with `@pytest.mark.dockerfile()` to trigger the build. The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
pytestbased validation framework AzureLinux's OCI container images, integrated withazldev image testTest it locally by (make sure to install and start podman first):