Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

launch multiple scenarios with a context manager #22

Open
goodboy opened this issue Aug 22, 2016 · 0 comments
Open

launch multiple scenarios with a context manager #22

goodboy opened this issue Aug 22, 2016 · 0 comments

Comments

@goodboy
Copy link
Member

goodboy commented Aug 22, 2016

Ended up using something similar for some FreeSWITCH cluster testing and figured it might as well be part of the pysipp API:

from contextlib import contextmanager

@contextmanager
def multicall(dialers):
    finalizers = []
    for for dialer in dialers:
        finalizers.append(dialer(block=False))

    yield dialers

    for finalize in finalizers:
        finalize()

It basically wraps the async usage from the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant