jeudi 1 septembre 2016

Unittesting a function containing an infinite loop

Given a function handling requests on a connection the body of the function is a infinite loop:

def handle_connection():
    # initialize stuff
    ...

    while True:
        # stuff to get the request
        ...

        # stuff to handle the request
        ...

How would I unittest this function?

Aucun commentaire:

Enregistrer un commentaire