Skip to content

Context manager and utilities to collect/combine results of multiple assertions #34

@benoitbryon

Description

@benoitbryon

In order to replace things like:

@hospital.healthcheck
def test_multiple():
    errors = []
    for domain in 'example.com', 'www.example.com':
        try:
            hospital.assert_ping(domain)
        except AssertionError, e:
            errors.append(e)
    if errors:
        raise AssertionError('\n'.join(errors))

With something like:

@hospital.healthcheck
def test_multiple():
    with hospital.multiple_assertions:
        for domain in 'example.com', 'www.example.com':
            hospital.assert_ping(domain)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions