Skip to main content

Test Docker container images

Project description

https://img.shields.io/pypi/v/seaworthy.svg https://readthedocs.org/projects/seaworthy/badge/?version=latest https://travis-ci.org/praekeltfoundation/seaworthy.svg?branch=develop https://codecov.io/gh/praekeltfoundation/seaworthy/branch/develop/graph/badge.svg

Seaworthy is a test harness for Docker container images. It allows you to use Docker containers and other Docker resources as fixtures for tests written in Python.

Seaworthy supports Python 3.4 and newer. You can find more information in the documentation.

Quick demo

First install Seaworthy along with pytest using pip:

pip install seaworthy[pytest]

Write some tests in a file, for example, test_echo_container.py:

from seaworthy.definitions import ContainerDefinition
from seaworthy.pytest.fixtures import resource_fixture

container = ContainerDefinition(
    'echo', 'jmalloc/echo-server',
    wait_patterns=[r'Echo server listening on port 8080'],
    create_kwargs={'ports': {'8080': None}})
fixture = resource_fixture(container, 'echo_container')


def test_echo(echo_container):
    r = echo_container.http_client().get('/foo')
    assert r.status_code == 200
    assert 'HTTP/1.1 GET /foo' in r.text

Run pytest:

pytest -v test_echo_container.py

Project status

Seaworthy should be considered alpha-level software. It is well-tested and works well for the first few things we have used it for, but we would like to use it for more of our Docker projects, which may require some parts of Seaworthy to evolve further. See the project issues for known issues/shortcomings.

The project was originally split out of the tests we wrote for our docker-django-bootstrap project. There are examples of Seaworthy in use there.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seaworthy-0.1.2.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

seaworthy-0.1.2-py3-none-any.whl (54.7 kB view details)

Uploaded Python 3

File details

Details for the file seaworthy-0.1.2.tar.gz.

File metadata

  • Download URL: seaworthy-0.1.2.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for seaworthy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9091feafdea1c249c07fea0a5d94744d0e3e1c2d559cba908bc698678bad2263
MD5 e17bb389a4f196e21072a9fcd055c2ae
BLAKE2b-256 e9505814b9847ac67e644d9ee9a91ef450863c70dedb79706e5a81d1f54473c2

See more details on using hashes here.

File details

Details for the file seaworthy-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for seaworthy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a07e6577c7bdb10027117a4cc20c2f470b4db85ba4daad7c2117d31f3062981
MD5 f5b9f4c728afdcb1ab901c4ef98c95ac
BLAKE2b-256 f09039ffedb52dd39d79e1e5d637fd431ab0bf375e2dd32f6a0ffcf468f95dbd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page