mirror of
https://github.com/containers/podman.git
synced 2025-07-31 20:32:39 +08:00
Refactor python tests to run against python3.9
* Introduce sub-package compat to meet packaging and import requirements * Update documenation for running tests * Add requirements.txt to improve IDE support Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
23
test/python/docker/compat/common.py
Normal file
23
test/python/docker/compat/common.py
Normal file
@ -0,0 +1,23 @@
|
||||
from docker import DockerClient
|
||||
|
||||
from test.python.docker.compat import constant
|
||||
|
||||
|
||||
def run_top_container(client: DockerClient):
|
||||
c = client.containers.create(
|
||||
constant.ALPINE, command="top", detach=True, tty=True, name="top"
|
||||
)
|
||||
c.start()
|
||||
return c.id
|
||||
|
||||
|
||||
def remove_all_containers(client: DockerClient):
|
||||
for ctnr in client.containers.list(all=True):
|
||||
ctnr.remove(force=True)
|
||||
|
||||
|
||||
def remove_all_images(client: DockerClient):
|
||||
for img in client.images.list():
|
||||
# FIXME should DELETE /images accept the sha256: prefix?
|
||||
id_ = img.id.removeprefix("sha256:")
|
||||
client.images.remove(id_, force=True)
|
Reference in New Issue
Block a user